Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to provide an embedded default font in the assembly #4760

Closed
ghost opened this issue Sep 28, 2020 · 10 comments
Closed

Is it possible to provide an embedded default font in the assembly #4760

ghost opened this issue Sep 28, 2020 · 10 comments

Comments

@ghost
Copy link

ghost commented Sep 28, 2020

No description provided.

@Gillibald
Copy link
Contributor

Gillibald commented Sep 28, 2020

There are multiple ways to achieve this:

  1. Set FontFamily on your window. Controls will inherit this unless they have FontFamily explicitly set.
  2. Write a custom font manager and register it before startup https://github.com/AvaloniaUI/Avalonia/blob/master/tests/Avalonia.Skia.UnitTests/Media/CustomFontManagerImpl.cs

@GaoJones
Copy link

There is an error in following the steps above

  • [ ]
    Uploading 微信图片_20210311152836.png…

@Gillibald
Copy link
Contributor

You need to reupload the image or just copy/paste the output here

@hui3215
Copy link

hui3215 commented Aug 4, 2022

There are multiple ways to achieve this:

  1. Set FontFamily on your window. Controls will inherit this unless they have FontFamily explicitly set.
  2. Write a custom font manager and register it before startup https://github.com/AvaloniaUI/Avalonia/blob/master/tests/Avalonia.Skia.UnitTests/Media/CustomFontManagerImpl.cs

The method I use in the connection is var typefaceCollection = SKTypefaceCollectionCache.GetOrAddTypefaceCollection(msjhTypeFace.FontFamily); The result is empty, is there a problem?

@azwc
Copy link

azwc commented Mar 7, 2023

I think, for users who using the lib, set FontFamily should have been easy. like FontFamily = "xxx";.
It's bad to let users do a lot of complicated things just for a simple result.

sorry!

There are multiple ways to achieve this:

  1. Set FontFamily on your window. Controls will inherit this unless they have FontFamily explicitly set.
  2. Write a custom font manager and register it before startup https://github.com/AvaloniaUI/Avalonia/blob/master/tests/Avalonia.Skia.UnitTests/Media/CustomFontManagerImpl.cs

@Gillibald
Copy link
Contributor

What is simple about text processing?

@azwc
Copy link

azwc commented Mar 7, 2023

Which is better for users to write one line of code or more than 200 lines of code?
This is why the code should be encapsulated.

@timunie
Copy link
Contributor

timunie commented Mar 7, 2023

@go-nil if you have a really good idea how that can work in a x-plat solution like Avalonia, I think a PR is welcome. But keep in mind, we have to consider many different OS and also many different use-cases. I agree we will need more documentation on this topic.

@jgcodes2020
Copy link
Contributor

There are multiple ways to achieve this:

1. Set FontFamily on your window. Controls will inherit this unless they have FontFamily explicitly set.

2. Write a custom font manager and register it before startup https://github.com/AvaloniaUI/Avalonia/blob/master/tests/Avalonia.Skia.UnitTests/Media/CustomFontManagerImpl.cs

So apparently we aren't supposed to register custom font managers, what now?

@Blazero
Copy link

Blazero commented Nov 11, 2023

There are multiple ways to achieve this:

1. Set FontFamily on your window. Controls will inherit this unless they have FontFamily explicitly set.

2. Write a custom font manager and register it before startup https://github.com/AvaloniaUI/Avalonia/blob/master/tests/Avalonia.Skia.UnitTests/Media/CustomFontManagerImpl.cs

Setting FontFamily on the MainWindow works fine for most controls, but it doesn't work for tooltips of button.
Is this intentional or just a bug? How to make it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants