のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

Minikin getFontTable

     80 bool FontFamily::addFont(MinikinFont* typeface) {
     81     AutoMutex _l(gMinikinLock);

     82     const uint32_t os2Tag = MinikinFont::MakeTag('O', 'S', '/', '2');


     83     HbBlob os2Table(getFontTable(typeface, os2Tag));


     84     if (os2Table.get() == nullptr) return false;
     85     int weight;
     86     bool italic;
     87     if (analyzeStyle(os2Table.get(), os2Table.size(), &weight, &italic)) {
     88         //ALOGD("analyzed weight = %d, italic = %s", weight, italic ? "true" : "false");
     89         FontStyle style(weight, italic);
     90         addFontLocked(typeface, style);
     91         return true;
     92     } else {
     93         ALOGD("failed to analyze style");
     94     }
     95     return false;
     96 }

Cross Reference: /frameworks/minikin/libs/minikin/FontFamily.cpp

    172 const SparseBitSet* FontFamily::getCoverage() {
    173     if (!mCoverageValid) {
    174         const FontStyle defaultStyle;

    175         MinikinFont* typeface = getClosestMatch(defaultStyle).font;

    176         const uint32_t cmapTag = MinikinFont::MakeTag('c', 'm', 'a', 'p');


    177         HbBlob cmapTable(getFontTable(typeface, cmapTag));


    178         if (cmapTable.get() == nullptr) {
    179             ALOGE("Could not get cmap table size!\n");
    180             // Note: This means we will retry on the next call to getCoverage, as we can't store
    181             //       the failure. This is fine, as we assume this doesn't really happen in practice.
    182             return nullptr;
    183         }
    184         // TODO: Error check?
    185         CmapCoverage::getCoverage(mCoverage, cmapTable.get(), cmapTable.size(), &mHasVSTable);
    186 #ifdef VERBOSE_DEBUG
    187         ALOGD("font coverage length=%d, first ch=%x\n", mCoverage.length(),
    188                 mCoverage.nextSetBit(0));
    189 #endif
    190         mCoverageValid = true;
    191     }
    192     return &mCoverage;
    193 }

Cross Reference: /frameworks/minikin/libs/minikin/FontFamily.cpp