Skia中遍历Linux系统字库文件

Skia 是android平台使用的2D图形库。但这个库的设计目标是能够跨平台的使用,因而尽管目前还不是很完善,但在Linux平台下大部分功能还是能够使用的。

Skia内建字库文件管理系统。Skia用SkTypeface来抽象字库文件。在首次创建一个SkTypeface时,Skia会将系统中所有的字库文件的信息都load进来,以方便后续使用。这样在随后画字时,都不再需要专门指定字库文件,Skia自己会有一套机制去找到正确的字库文件。然后从字库文件里面抓Glyph及其相关信息出来。

Skia将系统中所有的字库文件的信息都load进来,是在load_system_fonts()中,通过遍历某一个列表或目录来完成的。对于Linux系统,它就是遍历如下这个folder下的所有字库文件。

#ifndef SK_FONT_FILE_PREFIX
    #define SK_FONT_FILE_PREFIX      "/usr/share/fonts/truetype/"
#endif

Linux下load_system_fonts()的相关部分如下:

static void load_system_fonts() {
    // check if we've already be called
    if (NULL != gDefaultNormal) {
        printf("---- default font %p\n", gDefaultNormal);
        return;
    }

    SkOSFile::Iter  iter(SK_FONT_FILE_PREFIX, ".ttf");
    SkString        name;
    int             count = 0;

    while (iter.next(&name, false)) {

我们可以看到,Skia中通过SkOSFile::Iter这个class来迭代系统字库文件folder下的所有的字库文件。对于这个class,我们主要关注SkOSFile::Iter::reset()及SkOSFile::Iter::next()这两个函数。可以看到,这个class也做了诸多跨平台相关的设计。我们主要看138行之后的code。仔细看SkOSFile::Iter::next()这个函数,我们可以发现它有一个让人觉得很不爽的地方,那就是,它只访问了系统字库文件夹这一级folder下的字库文件,对于系统字库文件夹下的子文件夹中包含的字库文件,则完全置之不理。这种写法所造成的后果就是,在我的Ubuntu上,这个方法就只能找到一个字库文件。

#include "SkOSFile.h"

#ifdef SK_BUILD_FOR_WIN

static uint16_t* concat_to_16(const char src[], const char suffix[])
{
    size_t  i, len = strlen(src);
    size_t  len2 = 3 + (suffix ? strlen(suffix) : 0);
    uint16_t* dst = (uint16_t*)sk_malloc_throw((len + len2) * sizeof(uint16_t));

    for (i = 0; i < len; i++)
        dst[i] = src[i];

    if (i > 0 && dst[i-1] != '/')
        dst[i++] = '/';
    dst[i++] = '*';

    if (suffix)
    {
        while (*suffix)
            dst[i++] = *suffix++;
    }
    dst[i] = 0;
    SkASSERT(i + 1 <= len + len2);

    return dst;
}

SkUTF16_Str::SkUTF16_Str(const char src[])
{
    size_t  len = strlen(src);

    fStr = (uint16_t*)sk_malloc_throw((len + 1) * sizeof(uint16_t));
    size_t i;
    for (i = 0; i < len; i++)
        fStr[i] = src[i];
    fStr[i] = 0;
}

////////////////////////////////////////////////////////////////////////////

SkOSFile::Iter::Iter() : fHandle(0), fPath16(NULL)
{
}

SkOSFile::Iter::Iter(const char path[], const char suffix[]) : fHandle(0), fPath16(NULL)
{
    this->reset(path, suffix);
}

SkOSFile::Iter::~Iter()
{
    sk_free(fPath16);
    if (fHandle)
        ::FindClose(fHandle);
}

void SkOSFile::Iter::reset(const char path[], const char suffix[])
{
    if (fHandle)
    {
        ::FindClose(fHandle);
        fHandle = 0;
    }
    if (NULL == path)
        path = "";

    sk_free(fPath16);
    fPath16 = concat_to_16(path, suffix);
}

static bool is_magic_dir(const uint16_t dir[])
{
    // return true for "." and ".."
    return dir[0] == '.' && (dir[1] == 0 || dir[1] == '.' && dir[2] == 0);
}

static bool get_the_file(HANDLE handle, SkString* name, WIN32_FIND_DATAW* dataPtr, bool getDir)
{
    WIN32_FIND_DATAW    data;

    if (NULL == dataPtr)
    {
        if (::FindNextFileW(handle, &data))
            dataPtr = &data;
        else
            return false;
    }

    for (;;)
    {
        if (getDir)
        {
            if ((dataPtr->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && !is_magic_dir((uint16_t*)dataPtr->cFileName))
                break;
        }
        else
        {
            if (!(dataPtr->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
                break;
        }
        if (!::FindNextFileW(handle, dataPtr))
            return false;
    }
    // if we get here, we've found a file/dir
    if (name)
        name->setUTF16((uint16_t*)dataPtr->cFileName);
    return true;
}

bool SkOSFile::Iter::next(SkString* name, bool getDir)
{
    WIN32_FIND_DATAW    data;
    WIN32_FIND_DATAW*   dataPtr = NULL;

    if (fHandle == 0)   // our first time
    {
        if (fPath16 == NULL || *fPath16 == 0)    // check for no path
            return false;

        fHandle = ::FindFirstFileW((LPCWSTR)fPath16, &data);
        if (fHandle != 0 && fHandle != (HANDLE)~0)
            dataPtr = &data;
    }
    return fHandle != (HANDLE)~0 && get_the_file(fHandle, name, dataPtr, getDir);
}

#elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX)

#if 0
OSStatus FSPathMakeRef (
   const UInt8 * path,
   FSRef * ref,
   Boolean * isDirectory
);
#endif

SkOSFile::Iter::Iter() : fDIR(0)
{
}

SkOSFile::Iter::Iter(const char path[], const char suffix[]) : fDIR(0)
{
    this->reset(path, suffix);
}

SkOSFile::Iter::~Iter()
{
    if (fDIR)
        ::closedir(fDIR);
}

void SkOSFile::Iter::reset(const char path[], const char suffix[])
{
    if (fDIR)
    {
        ::closedir(fDIR);
        fDIR = 0;
    }

    fPath.set(path);
    if (path)
    {
        fDIR = ::opendir(path);
        fSuffix.set(suffix);
    }
    else
        fSuffix.reset();
}

// returns true if suffix is empty, or if str ends with suffix
static bool issuffixfor(const SkString& suffix, const char str[])
{
    size_t  suffixLen = suffix.size();
    size_t  strLen = strlen(str);

    return  strLen >= suffixLen &&
            memcmp(suffix.c_str(), str + strLen - suffixLen, suffixLen) == 0;
}

#include <sys/stat.h>

bool SkOSFile::Iter::next(SkString* name, bool getDir)
{
    if (fDIR)
    {
        dirent* entry;

        while ((entry = ::readdir(fDIR)) != NULL)
        {
            struct stat s;
            SkString    str(fPath);

            if (!str.endsWith("/") && !str.endsWith("\\"))
                str.append("/");
            str.append(entry->d_name);

            if (0 == stat(str.c_str(), &s))
            {
                if (getDir)
                {
                    if (s.st_mode & S_IFDIR)
                        break;
                }
                else
                {
                    if (!(s.st_mode & S_IFDIR) && issuffixfor(fSuffix, entry->d_name))
                        break;
                }
            }
        }
        if (entry)  // we broke out with a file
        {
            if (name)
                name->set(entry->d_name);
            return true;
        }
    }
    return false;
}

#endif

有让人不爽的地方,那就要改。如下面这个,我们自己实现这个迭代过程。遍历系统字库文件夹及其子folder下的所有的字库文件。我们通过一个Stack来完成这个过程。如下面这段Code:

/*
 * OSFileIter.cpp
 *
 *  Created on: Feb 23, 2013
 *      Author: hanpfei
 */

#include "OSFileIter.h"

#include <sys/stat.h>

#include <iostream>
using std::cout;
using std::cerr;
using std::endl;
#include <cstring>

OSFileIter::OSFileIter(const char *path, const char *suffix) : fDIR(0), fOrigPath(path) {
    this->reset(path, suffix);
}

OSFileIter::OSFileIter() : fDIR(0) {

}

// returns true if suffix is empty, or if str ends with suffix
static bool issuffixfor(const SkString& suffix, const char str[])
{
    size_t  suffixLen = suffix.size();
    size_t  strLen = strlen(str);

    return  strLen >= suffixLen &&
            memcmp(suffix.c_str(), str + strLen - suffixLen, suffixLen) == 0;
}

static void GetFullPathForSysFonts(SkString* full, const char path[], const char name[])
{
    full->append(path);
    full->append("/");
    full->append(name);
}

bool OSFileIter::next(SkString *name, bool getDir) {
    if (fDIR) {
        dirent* entry;
        while ((entry = ::readdir(fDIR)) != NULL || !fUnsearchedSubDir.empty()) {
            if(entry == NULL) {
                SkString subDir = fUnsearchedSubDir.at(fUnsearchedSubDir.size() - 1);
                fUnsearchedSubDir.pop_back();
                this->reset(subDir.c_str(), fSuffix.c_str());
                continue;
            }
            if (!::strcmp(entry->d_name, ".") || !::strcmp(entry->d_name, "..")) {
                continue;
            }
            struct stat s;
            SkString str(fPath);

            if (!str.endsWith("/") && !str.endsWith("\\")) {
                str.append("/");
            }
            str.append(entry->d_name);

            if (0 == stat(str.c_str(), &s)) {
                if (s.st_mode & S_IFDIR) {
                    fUnsearchedSubDir.push_back(str);
                    if (getDir) {
                        break;
                    }
                } else {
                    if(issuffixfor(fSuffix, entry->d_name)) {
                        break;
                    }
                }
            }
        }
        if (entry) // we broke out with a file
        {
            if (name) {
                name->reset();
                GetFullPathForSysFonts(name, fPath.c_str(), entry->d_name);
            }
            return true;
        }
    }
    return false;
}

void OSFileIter::reset(const char *path, const char *suffix) {
    if (fDIR) {
        ::closedir(fDIR);
        fDIR = 0;
    }

    fPath.set(path);
    if (path) {
        fDIR = ::opendir(path);
        fSuffix.set(suffix);
    } else {
        fSuffix.reset();
    }
}

OSFileIter::~OSFileIter() {
    if (fDIR) {
        ::closedir(fDIR);
    }
    cout << "fOrigPath = " << fOrigPath.c_str() << endl;
}

如下是我们使用上述方法,访问到的所有的系统字库文件:

hanpfei@ubuntu:/media/hanpfei/LinData/font_language/skia-lib/trunk/test_skia/Debug$ ./test-skia
font file path: /usr/share/fonts/truetype//fonts-japanese-gothic.ttf
font file path: /usr/share/fonts/truetype/tibetan-machine/TibetanMachineUni.ttf
font file path: /usr/share/fonts/truetype/lao/Phetsarath_OT.ttf
font file path: /usr/share/fonts/truetype/ezra/SILEOT.ttf
font file path: /usr/share/fonts/truetype/ezra/SILEOTSR.ttf
font file path: /usr/share/fonts/truetype/nanum/NanumMyeongjo.ttf
font file path: /usr/share/fonts/truetype/nanum/NanumGothic.ttf
font file path: /usr/share/fonts/truetype/nanum/NanumMyeongjoBold.ttf
font file path: /usr/share/fonts/truetype/nanum/NanumGothicBold.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Oblique.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-Oblique.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-ExtraLight.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed-Italic.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-BoldItalic.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Bold.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Italic.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed-BoldItalic.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Oblique.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-Bold.ttf
font file path: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed-Bold.ttf
font file path: /usr/share/fonts/truetype/sinhala/lklug.ttf
font file path: /usr/share/fonts/truetype/ttf-devanagari-fonts/lohit_ne.ttf
font file path: /usr/share/fonts/truetype/ttf-devanagari-fonts/lohit_kok.ttf
font file path: /usr/share/fonts/truetype/ttf-devanagari-fonts/nakula.ttf
font file path: /usr/share/fonts/truetype/ttf-devanagari-fonts/Sarai_07.ttf
font file path: /usr/share/fonts/truetype/ttf-devanagari-fonts/kalimati.ttf
font file path: /usr/share/fonts/truetype/ttf-devanagari-fonts/Samyak-Devanagari.ttf
font file path: /usr/share/fonts/truetype/ttf-devanagari-fonts/lohit_mr.ttf
font file path: /usr/share/fonts/truetype/ttf-devanagari-fonts/chandas1-2.ttf
font file path: /usr/share/fonts/truetype/ttf-devanagari-fonts/lohit_mai.ttf
font file path: /usr/share/fonts/truetype/ttf-devanagari-fonts/lohit_ks.ttf
font file path: /usr/share/fonts/truetype/ttf-devanagari-fonts/samanata.ttf
font file path: /usr/share/fonts/truetype/ttf-devanagari-fonts/lohit_sd.ttf
font file path: /usr/share/fonts/truetype/ttf-devanagari-fonts/sahadeva.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstOffice.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstPen.ttf
font file path: /usr/share/fonts/truetype/kacst/mry_KacstQurn.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstFarsi.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstArt.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstLetter.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstBook.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstQurn.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstDecorative.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstTitle.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstDigital.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstTitleL.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstNaskh.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstScreen.ttf
font file path: /usr/share/fonts/truetype/kacst/KacstPoster.ttf
font file path: /usr/share/fonts/truetype/padauk/Padauk-book.ttf
font file path: /usr/share/fonts/truetype/padauk/Padauk.ttf
font file path: /usr/share/fonts/truetype/padauk/Padauk-bookbold.ttf
font file path: /usr/share/fonts/truetype/padauk/Padauk-bold.ttf
font file path: /usr/share/fonts/truetype/takao-gothic/TakaoPGothic.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgTypo-Bold.ttf
font file path: /usr/share/fonts/truetype/tlwg/Kinnari-BoldItalic.ttf
font file path: /usr/share/fonts/truetype/tlwg/Purisa-Oblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Loma.ttf
font file path: /usr/share/fonts/truetype/tlwg/Loma-Bold.ttf
font file path: /usr/share/fonts/truetype/tlwg/Waree-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgTypo-Oblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgTypo-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgTypewriter.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgTypewriter-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Norasi-Oblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Loma-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgMono-Bold.ttf
font file path: /usr/share/fonts/truetype/tlwg/Norasi-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Sawasdee.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgTypo.ttf
font file path: /usr/share/fonts/truetype/tlwg/Waree.ttf
font file path: /usr/share/fonts/truetype/tlwg/Waree-Bold.ttf
font file path: /usr/share/fonts/truetype/tlwg/Garuda-Oblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Kinnari-Oblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgTypist-Oblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Garuda.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgMono-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgMono-Oblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgTypist-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgTypewriter-Oblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Umpush.ttf
font file path: /usr/share/fonts/truetype/tlwg/Kinnari.ttf
font file path: /usr/share/fonts/truetype/tlwg/Norasi-BoldItalic.ttf
font file path: /usr/share/fonts/truetype/tlwg/Purisa.ttf
font file path: /usr/share/fonts/truetype/tlwg/Norasi-Italic.ttf
font file path: /usr/share/fonts/truetype/tlwg/Umpush-Oblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Umpush-Bold.ttf
font file path: /usr/share/fonts/truetype/tlwg/Purisa-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Garuda-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Umpush-LightOblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Kinnari-Italic.ttf
font file path: /usr/share/fonts/truetype/tlwg/Umpush-Light.ttf
font file path: /usr/share/fonts/truetype/tlwg/Sawasdee-Bold.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgMono.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgTypist-Bold.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgTypewriter-Bold.ttf
font file path: /usr/share/fonts/truetype/tlwg/Waree-Oblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Garuda-Bold.ttf
font file path: /usr/share/fonts/truetype/tlwg/Sawasdee-Oblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Kinnari-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Purisa-Bold.ttf
font file path: /usr/share/fonts/truetype/tlwg/Loma-Oblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/TlwgTypist.ttf
font file path: /usr/share/fonts/truetype/tlwg/Norasi.ttf
font file path: /usr/share/fonts/truetype/tlwg/Sawasdee-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Umpush-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/tlwg/Kinnari-Bold.ttf
font file path: /usr/share/fonts/truetype/tlwg/Norasi-Bold.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/Malige-n.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/Malige-b.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/utkal.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/Pothana2000.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_ta.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/Rekha.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/Vemana.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/Meera_04.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_hi.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/Kedage-b.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_bn.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_gu.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/MuktiNarrowBold.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/MuktiNarrow.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/Kedage-n.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/gargi.ttf
font file path: /usr/share/fonts/truetype/ttf-indic-fonts-core/Rachana_04.ttf
font file path: /usr/share/fonts/truetype/ttf-punjabi-fonts/Saab.ttf
font file path: /usr/share/fonts/truetype/ttf-punjabi-fonts/lohit_pa.ttf
font file path: /usr/share/fonts/truetype/abyssinica/AbyssinicaSIL-R.ttf
font file path: /usr/share/fonts/truetype/farsiweb/titr.ttf
font file path: /usr/share/fonts/truetype/farsiweb/homa.ttf
font file path: /usr/share/fonts/truetype/farsiweb/nazli.ttf
font file path: /usr/share/fonts/truetype/farsiweb/nazlib.ttf
font file path: /usr/share/fonts/truetype/scheherazade/ScheherazadeRegOT.ttf
font file path: /usr/share/fonts/truetype/ttf-khmeros-core/KhmerOSsys.ttf
font file path: /usr/share/fonts/truetype/ttf-khmeros-core/KhmerOS.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Hani.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_AlYarmook.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Arab.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Graph.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Rehan.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Mashq.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Tarablus.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Ouhod-Bold.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Granada.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Sindbad.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Furat.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Nada.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Ostorah.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Kayrawan.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Metal.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Shado.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_AlArabiya.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Rasheeq-Bold.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Electron.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Mashq-Bold.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Nagham.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_AlHor.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Haramain.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Japan.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Sharjah.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Jet.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Khalid.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Hor.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_AlManzomah.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Petra.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Dimnah.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_AlBattar.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Salem.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Tholoth.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Nice.ttf
font file path: /usr/share/fonts/truetype/fonts-arabeyes/ae_Cortoba.ttf
font file path: /usr/share/fonts/truetype/freefont/FreeSerifBold.ttf
font file path: /usr/share/fonts/truetype/freefont/FreeMonoOblique.ttf
font file path: /usr/share/fonts/truetype/freefont/FreeSansBold.ttf
font file path: /usr/share/fonts/truetype/freefont/FreeSerifBoldItalic.ttf
font file path: /usr/share/fonts/truetype/freefont/FreeMono.ttf
font file path: /usr/share/fonts/truetype/freefont/FreeSansOblique.ttf
font file path: /usr/share/fonts/truetype/freefont/FreeSerif.ttf
font file path: /usr/share/fonts/truetype/freefont/FreeMonoBold.ttf
font file path: /usr/share/fonts/truetype/freefont/FreeSerifItalic.ttf
font file path: /usr/share/fonts/truetype/freefont/FreeSans.ttf
font file path: /usr/share/fonts/truetype/freefont/FreeMonoBoldOblique.ttf
font file path: /usr/share/fonts/truetype/freefont/FreeSansBoldOblique.ttf
font file path: /usr/share/fonts/truetype/culmus/SimpleCLM-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/culmus/FrankRuehlCLM-MediumOblique.ttf
font file path: /usr/share/fonts/truetype/culmus/FrankRuehlCLM-Medium.ttf
font file path: /usr/share/fonts/truetype/culmus/KeterYG-Medium.ttf
font file path: /usr/share/fonts/truetype/culmus/HadasimCLM-Regular.ttf
font file path: /usr/share/fonts/truetype/culmus/SimpleCLM-MediumOblique.ttf
font file path: /usr/share/fonts/truetype/culmus/SimpleCLM-Bold.ttf
font file path: /usr/share/fonts/truetype/culmus/MiriamMonoCLM-Book.ttf
font file path: /usr/share/fonts/truetype/culmus/MiriamMonoCLM-BookOblique.ttf
font file path: /usr/share/fonts/truetype/culmus/StamSefaradCLM.ttf
font file path: /usr/share/fonts/truetype/culmus/SimpleCLM-Medium.ttf
font file path: /usr/share/fonts/truetype/culmus/HadasimCLM-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/culmus/FrankRuehlCLM-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/culmus/HadasimCLM-RegularOblique.ttf
font file path: /usr/share/fonts/truetype/culmus/FrankRuehlCLM-Bold.ttf
font file path: /usr/share/fonts/truetype/culmus/MiriamCLM-Bold.ttf
font file path: /usr/share/fonts/truetype/culmus/DavidCLM-MediumItalic.ttf
font file path: /usr/share/fonts/truetype/culmus/DavidCLM-Bold.ttf
font file path: /usr/share/fonts/truetype/culmus/KeterYG-MediumOblique.ttf
font file path: /usr/share/fonts/truetype/culmus/MiriamMonoCLM-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/culmus/HadasimCLM-Bold.ttf
font file path: /usr/share/fonts/truetype/culmus/MiriamMonoCLM-Bold.ttf
font file path: /usr/share/fonts/truetype/culmus/DavidCLM-Medium.ttf
font file path: /usr/share/fonts/truetype/culmus/KeterYG-BoldOblique.ttf
font file path: /usr/share/fonts/truetype/culmus/StamAshkenazCLM.ttf
font file path: /usr/share/fonts/truetype/culmus/KeterYG-Bold.ttf
font file path: /usr/share/fonts/truetype/culmus/DavidCLM-BoldItalic.ttf
font file path: /usr/share/fonts/truetype/culmus/MiriamCLM-Book.ttf
font file path: /usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf
font file path: /usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-BI.ttf
font file path: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-LI.ttf
font file path: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-RI.ttf
font file path: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-MI.ttf
font file path: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf
font file path: /usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-B.ttf
font file path: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-M.ttf
font file path: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-BI.ttf
font file path: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-L.ttf
font file path: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-C.ttf
font file path: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf
font file path: /usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-RI.ttf
font file path: /usr/share/fonts/truetype/kacst-one/KacstOne-Bold.ttf
font file path: /usr/share/fonts/truetype/kacst-one/KacstOne.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationSerif-Italic.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationSerif-Regular.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationSerif-BoldItalic.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationSansNarrow-Regular.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationSansNarrow-Bold.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationMono-BoldItalic.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationSans-Italic.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationSans-BoldItalic.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationSerif-Bold.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationSansNarrow-Italic.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationMono-Italic.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationSansNarrow-BoldItalic.ttf
font file path: /usr/share/fonts/truetype/liberation/LiberationMono-Bold.ttf
font file path: /usr/share/fonts/truetype/openoffice/opens___.ttf
font file path: /usr/share/fonts/truetype/fonts-japanese-gothic.ttf

话说Ubuntu下包含的default的字库文件还真够多的。

你可能感兴趣的:(Skia中遍历Linux系统字库文件)