Skia with fontconfig support

19 views
Skip to first unread message

Cedric

unread,
Jul 18, 2024, 7:35:14 AM (4 days ago) Jul 18
to skia-discuss
Hello,

I'm trying to build Skia with support for fontconfig on Linux. I would like to use the SkFontMgr based on fontconfg, by creating it through the SkFontMgr_New_FontConfig exported function.

When building Skia, I explicitely added the flag: skia_use_fontconfig=true (which is anyway true be default).

In my own code (which is linked against libskia.so), when I call the SkFontMgr_New_FontConfig method, I get the following link error: "undefined reference to `SkFontMgr_New_FontConfig(_FcConfig*)'".

I'm sure that I'm linking properly against Skia since everything else is working fine: for instance calling the SkFontMgr_New_Custom_Directory works fine (I can draw text and everything).

I had a look in the build folders for Skia, and there is a  fontmgr_fontconfig.SkFontMgr_fontconfig.o object file available (meaning the SkFontMgr based on fontconfig has been built). However, when I look at the exported symbols in libskia.so (nm -D libskia.so), I cannot find the exported SkFontMgr_New_FontConfig function (the one for custom directory is well present). This explains the undefined reference in my own code.

What am I missing herre? Why is Skia not exporting the function properly?

Thanks

bungeman

unread,
Jul 18, 2024, 10:43:14 AM (4 days ago) Jul 18
to skia-discuss

This is because SkFontMgr_fontconfig.cpp (which defines SkFontMgr_New_FontConfig) does not currently include SkFontMgr_fontconfig.h (which declares SkFontMgr_New_FontConfig as SK_API). As a result the declaration was "exported" but the definition was not. This should be fixed by https://skia-review.googlesource.com/c/skia/+/878977 .
Reply all
Reply to author
Forward
0 new messages