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
UI font rendering: use available bold fonts for bold #5675
Conversation
Just added a hidden setting to avoid using bold fonts when May be I'm too used after a few weeks to the "thin" bold made by FreeType Outline emboldening, but I find the real bold provided by NotoSansBold a bit less elegant than the fake bold :) Mainly in ButtonTable/ButtonDialog (the highlight dialog, or the button at the bottom of the dict result) - it's also wider, so more prone to have buttons' long translated text truncated. Before XText, we had for these the regular font with Freetype Glyph emboldening, which made the glyphs wider. Anyway, please tell me how you like it or not when this is merged. If we'd just want to have narrower bold for buttons, we could just go with: --- a/frontend/ui/widget/button.lua
+++ b/frontend/ui/widget/button.lua
@@ -49,5 +49,5 @@ local Button = InputContainer:new{
text_font_face = "cfont",
text_font_size = 20,
- text_font_bold = true,
+ text_font_bold = Font.FORCE_SYNTHETIZED_BOLD,
}
|
A few fixes and enhancement related to bold text: - When using bold=true with a regular font, use its bold variant if one exists (can be prevented by manually adding a setting: "use_bold_font_for_bold" = false). - When using a bold font without bold=true, promote bold to true, so fallback fonts are drawn bold too. - Whether using a bold font, or using bold=true, ensure fallback fonts are drawn bold, with their available bold variant if one exists, or with synthetized bold. - When using a bold variant of a fallback font, keep using the regular variant as another fallback (as bold fonts may contain less glyphs than their regular counterpart). - Allow providing bold=Font.FORCE_SYNTHETIZED_BOLD to get synth bold even when a bold font exists (might be interesting to get text in bold the same width as the same text non-bold). - Use the font realname in the key when caching glyphs, instead of our aliases (cfont, infont...) to avoid duplication and wasting memory. allow avoiding font promotion to bold font
1e86920
to
aabee34
Compare
Adding this note in this issue that is the most recent Freetype/Font related PR. From #5525 (comment):
Regarding that, I had a look. It's quite hard to get into :| and understand the interaction of face, size, and the FTC_ImageCache_Lookup that don't accept any face or size as parameters :) Hopefully, there's another quite discreet function FTC_ImageCache_LookupScaler that looks better. Anyway, I didn't find much code that uses it, and the only one I found that uses it in a way similar to how we could use it is: So, the idea is that instead of instantiating a FT face and keep it as ftface in our face_obj object, we'd just store an ID, and never instantiante a FT_Face directly, and just provide that ID to ffi wrappers that would use these FTC_ functions, that would hiddenly manage these FT_Face instances in some kind of a pool. We could still use it to cache glyphs, and drop our Lua glyph Cache - but there would still be that alternative pool of FT_Face used by that cache, so we'll have these duplicated anyway. So, dropping any more thinking about switching to it :) |
Yeah, even in the best of worlds, mixed with plain HB, that would have made things more complex, that's perfectly understandable ;). |
Any feedback on this? @NiLuJe (you're the customer for real bold :), you're fine with NotoSansBold being more often used? |
I like both approaches :). I do prefer the new fake bold compared to the
old fake bold, though ;).
…On Fri, Dec 13, 2019, 08:51 poire-z ***@***.***> wrote:
May be I'm too used after a few weeks to the "thin" bold made by FreeType
Outline emboldening, but I find the real bold provided by NotoSansBold a
bit less elegant than the fake bold :) Mainly in ButtonTable/ButtonDialog
(the highlight dialog, or the button at the bottom of the dict result) -
and for the book titles in CoverBrowser list mode
Any feedback on this? @NiLuJe <https://github.com/NiLuJe> (you're the
customer for real bold :), you're fine with NotoSansBold being more often
used?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5675?email_source=notifications&email_token=AAA3KZQTR7DYABTJRDGCH4DQYM5HNA5CNFSM4JXSD5M2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGZGIJI#issuecomment-565339173>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA3KZWQYFDOFQBGNM5RDBTQYM5HNANCNFSM4JXSD5MQ>
.
|
A few fixes and enhancement related to bold text: - When using bold=true with a regular font, use its bold variant if one exists (can be prevented by manually adding a setting: "use_bold_font_for_bold" = false). - When using a bold font without bold=true, promote bold to true, so fallback fonts are drawn bold too. - Whether using a bold font, or using bold=true, ensure fallback fonts are drawn bold, with their available bold variant if one exists, or with synthetized bold. - When using a bold variant of a fallback font, keep using the regular variant as another fallback (as bold fonts may contain less glyphs than their regular counterpart). - Allow providing bold=Font.FORCE_SYNTHETIZED_BOLD to get synth bold even when a bold font exists (might be interesting to get text in bold the same width as the same text non-bold). - Use the font realname in the key when caching glyphs, instead of our aliases (cfont, infont...) to avoid duplication and wasting memory.
Follow up to #5598 "we might need to work on our bold font use and handling..."
A few fixes and enhancement related to bold text:
bold=true
with a regular font, use its bold variant if one exists.bold=true
, promotebold
totrue
, so fallback fonts are drawn bold too.bold=true
, ensure fallback fonts are drawn bold, with their available bold variant if one exists, or with synthetized bold.bold=Font.FORCE_SYNTHETIZED_BOLD
to get fake bold even when a bold font exists (might be interesting to get text in bold the same width as the same text non-bold).Some of these issues are there since the switch to XText (#5598), but some where there before. I think CJK users may have seen our titles non-bold (I hope using synthetized bold with NotoSansCJK is ok and doesn't make the CJK glyphs too busy).
Before:
After:
Before:
After:
This change is