In which skia CPP file "SkFontMgr" searchs for System fonts.

104 views
Skip to first unread message

javaid ahmad Wani

unread,
Jun 20, 2022, 10:04:22 AM6/20/22
to skia-discuss
Greetings of the day.

Generally, the system fonts files ( Typefaces  ) are available like
""""

./system/fonts/CarroisGothicSC-Regular.ttf
./system/fonts/ComingSoon.ttf
./system/fonts/CutiveMono.ttf
./system/fonts/DancingScript-Bold.ttf
./system/fonts/DancingScript-Regular.ttf
./system/fonts/DroidSans-Bold.ttf
./system/fonts/DroidSans.ttf
./system/fonts/DroidSansMono.ttf
./system/fonts/NotoColorEmoji.ttf
./system/fonts/NotoColorEmojiFlags.ttf
./system/fonts/NotoNaskhArabic-Bold.ttf
""""
I have not seen anywhere in skia  code  searches for path  " /system/fonts"  to get system fonts.

even Android provides fonts
""''
/data/data/com.google.android.gms/files/fonts/opentype/Google_Sans-400-100_0-0_0.ttf
./data/data/com.google.android.gms/files/fonts/opentype/Google_Sans-500-100_0-0_0.ttf
./data/data/com.google.android.gms/files/fonts/opentype/Google_Sans_Display-400-100_0-0_0.ttf
./data/data/com.google.android.gms/files/fonts/opentype/Google_Sans_Text-400-100_0-0_0.ttf
./data/data/com.google.android.gms/files/fonts/opentype/Google_Sans_Text-500-100_0-0_0.ttf
./data/data/com.google.android.gms/files/fonts/opentype/Google_Sans_Text-700-100_0-0_0.ttf
./data/data/com.google.android.gms/files/fonts/opentype/Google_Sans-700-100_0-0_0.ttf
./data/user/0/com.google.android.gms/files/fonts/opentype/Google_Sans-400-100_0-0_0.ttf
./data/user/0/com.google.android.gms/files/fonts/opentype/Google_Sans-500-100_0-0_0.ttf
./data/user/0/com.google.android.gms/files/fonts/opentype/Google_Sans_Display-400-100_0-0_0.ttf
./data/user/0/com.google.android.gms/files/fonts/opentype/Google_Sans_Text-400-100_0-0_0.ttf
./data/user/0/com.google.android.gms/files/fonts/opentype/Google_Sans_Text-500-100_0-0_0.ttf
./data/user/0/com.google.android.gms/files/fonts/opentype/Google_Sans_Text-700-100_0-0_0.ttf
./data/user/0/com.google.android.gms/files/fonts/opentype/Google_Sans-700-100_0-0_0.ttf

"""""""
 using bruteforce method i am able to set the types by providing direct path as shown in below code and I am able to draw text on target system (Android).  I even searched in "https://android.googlesource.com/platform/external/skia/+/refs/heads/oreo-mr1-dev/include/ports/". using the drawSimpletext() function. But I try to find the generic solution.  Any leads will be appreciated.
    
""
const char fp[] = "/system_ext/etc/mmi/fonts.ttf";
  sk_sp<SkTypeface> tf = typeface->MakeFromFile(fp);
 "font.setTypeface(tf);
""



Thanks and Regards
Javaid
Reply all
Reply to author
Forward
0 new messages