#fontconfig

nogajun🍉nogajun
2025-02-20

LibreOffice Writerでフォントを見てたらfontconfigがバグっててフォント名が文字化けしてた。trixieまでに直ってくれたらいいけど
bugs.debian.org/cgi-bin/bugrep

日本語フォント名が文字化けしていて、意味不明な文字列に変わっているスクリーンショット
Marguerite Sumarguerite@moe.cat
2025-02-18

chromium 的 skia 不能识别 sans-serif 能识别 sans 的原因找到了,其内部只认为 sans/serif/monospace 是需要 fallback 的,sans-serif 不是。基于这种假设,sans-serif 会应用其一般字体判断逻辑,即 #fontconfig 初始化后返回的第一个 sans-serif 和经过 fc-match -a 后的第一个 sans-serif 两者比较名称是否相同。但是 fc-match -a 有一个作用是把不存在于系统的字体剔除,如果是一般字体比如 Roboto 完全没有问题,初始化的 pattern 它肯定排第一个,因为没有规则对这种具体字体做 prepend 操作,这种比较实际上等于查找它在不在。但 sans-serif 不一样,存在的第一个字体绝大多数时候都不等于 pattern 的第一个字体。能 work 是因为到了 sans 这种 fallback 字体就不进行名称相同比较了。但这样效率只有 50%,因为所有写了 sans-serif 的网页都要做一次理论无效实际也无效的比较

Marguerite Sumarguerite@moe.cat
2025-02-16

越来越清晰了,继编译了 chromium 的魔改 content_shell 后,又制作了魔改版的 skia_debug_tool,已经能深入到 chromium 怎么调用 #fontconfig 了,博客再写下去能发 sci 了吧…回到前面的问题:日志里 times new roman 多是因为 chromium linux 默认的 standard font family 是它;sans-serif 不好使是因为在 matchFamilyName 环节用 zh_CN 的 namelang 匹配到了 Noto Sans。感觉这像是我自己的锅,因为 openSUSE 有个 config 是按照 Google 官方的 Noto Sans CJK 使用建议给中文前 prepend Source Sans 还是 Roboto 来着,印象里好像当时 prepend 的是 Noto Sans。然后 sans 好像 fontconfig 官方是 append 的 sans-serif,导致两者结果不一致。

Marguerite Sumarguerite@moe.cat
2025-02-14

魔改版的 chromium content_shell 已经做完了,发现几个比较有意思的问题:1. Chromium 每次不管加载什么网页都会先找 Times New Roman 2. 我曾经以为网页 css 写的 sans-serif 替换会发生在 Skia/fontconfig 里,其实不是,是 sans-serif 也找不到字体,blink 自动加入了 Sans,用 sans 在 Skia/fontconfig 里找到的中文字体。具体研究需要进一步制作魔改 plus 版 content_shell。#fontconfig

christmas skibidi tomato :nix: :tomatock:mischievoustomato@mitra.taihou.website
2024-12-03

Because KDE and essentially anything non-gnome supports it, I've enabled subpixel rendering again. I also use the truetype engine v35 and no font hinting. #KDE #nixOS #fontconfig #freetype

2024-11-09

Current `fonts.conf` for my account:

* Prefer Noto over Cantarell and Roboto
* Force ☹ to be emoji
* Enable hinting and anti-aliasing on non-Emoji fonts

Thunderbird still looks a little odd, but hopefully I just need to undo a setting somewhere.

dev.ibboard.co.uk/repos/other/

#Linux #Fonts #FontConfig #FontsConfig

2024-10-29

I think… I may have tracked it down!

GTK3 doesn't seem to like 13.3333px (which is 10pt). Round it to 13px and everything goes back to the right size!

I wonder what part of fonts-config made it stop rounding 🤔

Edit: Using "Tweak Tool" to set the UI font size to 9.75 gets me exactly 13px, which looks almost the same EXCEPT that it's not stretched on GTK3!

GTK4 is fractionally smaller, but it's better than the way GTK3 was too tall.

#Linux #Fonts #FontConfig #FontsConfig

zirias (on snac)zirias@snac.bsd.cafe
2024-10-13
After implementing "#dpi awareness" (calculate resolution of the primary screen and use this for #fontconfig patterns) in #Xmoji, I was unhappy with the (correct) result: Everything too large for my taste. I also added a resource dpi to override the calculated resolution, setting this to 72 gave me the previous results, but it's logically wrong.

I now did a different thing to solve this: Give the Font resource (the class name for fonts other than the emoji font) extra semantics. Xmoji now checks explicitly whether a resource for this class is set, and, if so, considers that value the "default system font", basing all sizes on that.

Now I can just add Xmoji*Font: sans-10 to my .Xresources and get the looks I like with all other settings left at their default on my 96dpi display. 🥳

If you have any objections or run into unexpected behavior testing this, please let me know. I'd like to release Xmoji 0.9 "soon". 😎
Xmoji with system font "sans-10" in a german locale on a 96dpi display
nogajun🍉nogajun
2024-10-07

Debian Sid のfontconfig 2.15.0-1.1がぶっ壊れている。日本語フォント名が文字化けしている

Gea-Suan Lingslin@abpe.org
2024-09-10

讓 Flatpak 裡面的應用程式可以吃到系統的字型

先前在「測試 Zen Browser」這邊提到 Zen,但遇到中文字型用了文泉驛正黑而沒有用 Noto Sans CJK TC 的問題,當時先一直放著,後來想到應該是 Flatpak 的 sandbox 造成的,用關鍵字找了

blog.gslin.org/archives/2024/0

#Browser #Computer #Murmuring #Security #Software #browser #flatpak #font #fontconfig #sandbox #zen

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-08-08

I just added code to #Xmoji applying #hinting settings from #fontconfig. I had an immediate reason... 🤔

Rasterizing my glyphs with #freetype (for rendering with #XRender), kerning breaks horribly for Microsoft fonts using the "native" truetype hinting. Forcing freetype's autohinter instead, it's (almost) fine (but hinting itself might be slightly lower quality).

Am I doing something wrong, or what the ... is the problem here? Example screenshots using "Segoe UI".

#X11 #programming

A Microsoft font rendered with freetype using native truetype hintingFontconfig configuration file to enable autohinting on all Microsoft fontsThe same Microsoft font rendered with freetype using the auto-hinter
2024-07-17

Listing monospace fonts with #fontconfig:

❯ fc-list :mono : family | sort -u
Andale Mono
BlexMono Nerd Font
BlexMono Nerd Font,BlexMono Nerd Font ExtraLight
BlexMono Nerd Font,BlexMono Nerd Font Light
BlexMono Nerd Font,BlexMono Nerd Font Medium
BlexMono Nerd Font,BlexMono Nerd Font SemiBold
BlexMono Nerd Font,BlexMono Nerd Font Text
BlexMono Nerd Font,BlexMono Nerd Font Thin
BlexMono Nerd Font Mono
BlexMono Nerd Font Mono,BlexMono Nerd Font Mono ExtraLight
BlexMono Nerd Font Mono,BlexMono Nerd Font Mono Light
BlexMono Nerd Font Mono,BlexMono Nerd Font Mono Medium
BlexMono Nerd Font Mono,BlexMono Nerd Font Mono SemiBold
BlexMono Nerd Font Mono,BlexMono Nerd Font Mono Text
BlexMono Nerd Font Mono,BlexMono Nerd Font Mono Thin
Courier New
Liberation Mono
MesloLGLDZ Nerd Font
MesloLGLDZ Nerd Font Mono
MesloLGL Nerd Font
MesloLGL Nerd Font Mono
MesloLGMDZ Nerd Font
MesloLGMDZ Nerd Font Mono
MesloLGM Nerd Font
MesloLGM Nerd Font Mono
MesloLGSDZ Nerd Font
MesloLGSDZ Nerd Font Mono
MesloLGS Nerd Font
MesloLGS Nerd Font Mono
Nimbus Mono PS
Noto Color Emoji
Source Code Pro
Source Code Pro,Source Code Pro Black
Source Code Pro,Source Code Pro ExtraLight
Source Code Pro,Source Code Pro Light
Source Code Pro,Source Code Pro Medium
Source Code Pro,Source Code Pro Semibold

Had to trial and error for a while so consider no to myself ;-)

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-06-17

@0x1eef @spnw Of course it has some dependencies ... didn't document anything yet, as it's still just experimentation. Isn't there some *more* output? It should really tell which package is missing.

Anyways, currently it needs (all listed in src/bin/xmoji/xmoji.mk):

- #xcb (with -cursor, -render and -xkb modules), the X11 protocol bindings
- #xkbcommon to maintain and use keyboard state
- #poser for the main event loop and a thread pool
- #fontconfig to find installed fonts by search patterns
- #harfbuzz to "shape" some text
- #freetype to load fonts, access and rasterize glyphs

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-05-25

More progress exploring #X11 #programming with #xcb 🥳

Added a first "container #widget", a vertical box, allowing me to display two "text labels" at the same time!

Screenshots:

1. No arguments (which will just ask #fontconfig for "sans" and "emoji" to get the respective system defaults)

2. '-font Cambria-18 -emojifont emoji-24'

3. '-font Calibri-18 -emojifont "Twitter Color Emoji-24" -- this one shows there's work left to do, obviously the twitter emoji font uses #SVG for color glyphs ... (so I'm getting the uncolored outlines instead)

Martin Owens :inkscape:doctormo@floss.social
2024-05-23

I'm slowly making my way through a 8 thousand line python addition to #inkscape's #python library for parsing text and font elements in #svg properly. It's important and useful, but it's also *a lot*.

I'm not sure how to say "please run pylint over your code because my eyes hurt trying to read this". without sounding like an ungrateful jerk. 😅

#codereview #programming #pango #fontconfig

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-05-15

@drscriptt Uhm, not really. I think the emoji keyboard is working "good enough" for now, here:
github.com/Zirias/qxmoji

It uses #Qt for the GUI, and I had an interesting issue with that, initializing a "button" for an emoji takes time. Not much, but enough to add up to seconds for the ~3.7k buttons needed. Plus there's no way to have Qt do that while still being responsive. My solution is an ugly hack with a timer, initializing one every 1ms (so, in between, Qt handles X11 events).

This lead me to just experiment with "plain #xcb" to see how far I could get that way. Of course you need to find and load fonts, shape texts and rasterize glyphs to show some text (or emojis) on the screen. I already added #fontconfig (find the font), #freetype (load it and rasterize glyphs) and #harfbuzz (shape the text, which e.g. includes mapping some #emoji grapheme cluster to a single glyph). It would be crazy to reinvent the wheel for all of that.

What's still missing is actually rendering the text. Examples you find use #cairo for that, yet another dependency I'd like to avoid if possible, so I hope it can be done with xcb using #XRender. Most of the work is interfacing between the different libraries' object models. 🙄

freetype and harfbuzz use fixed-point fractional numbers (uint32_t interpreted as 26.6) for many metrics. It seems with XRender, I can only specify rendering positions in whole pixels? Have to experiment further and see whether that will be an issue.

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-05-14

Quickly collecting dependencies meanwhile, this is how it looks like 🙄

I did add the first 5 (#fontconfig, #freetype, #harfbuzz, #poser, #xcb) explicitly. Poser is my own lib, it pulls in ssl/crypto for (build-time optional) support of TLS sockets. Fascinating what else I collected here 😂

Hell, there's even a C++ runtime? 🤨

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-05-11

Ok, after experimenting a bit with #fontconfig, seems it has a lot of "helpful" magic to "always give you *some* font". Nice, but that could be whatever. To allow an application-side priority list, I hacked comparing at least the family name of the suggested match, but as a very last resort, just request "sans" and take whatever you get 🙈

github.com/Zirias/xmoji/blob/8

Now I can create a FT_Face from the result with #freetype. Finding and rendering glyphs to FT_Bitmap seems straight forward, but how would I get that rendered on some #xcb drawable? I found an example using xcb-render-util, but that's "only good for ~252 glyphs" -- huh? 🤨

Anyone have a good example how to do it manually with maybe just xcb-render (without pulling in the next huge lib like cairo)? Maybe @thomasadam ? 😉

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2024-05-10

Another baby step (and a new dependency): locating a font. Yes, only locating. #X11 #font rendering with just #xcb, #fontconfig and #freetype will take a while 😎

the only reason i use #foot over other terminals is because it respects #fontconfig. There maybe no #ligatures but I don't really need them.

Currently loving #Iosevka Fixed variant with #foot

#terminal #fontconfig #fonts

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst