のねのBlog

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

getFontTable

     82 hb_blob_t* getFontTable(MinikinFont* minikinFont, uint32_t tag) {
     83     assertMinikinLocked();
     84     hb_font_t* font = getHbFontLocked(minikinFont);
     85     hb_face_t* face = hb_font_get_face(font);
     86     hb_blob_t* blob = hb_face_reference_table(face, tag);
     87     hb_font_destroy(font);
     88     return blob;
     89 }

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

    102 hb_font_t* getHbFontLocked(MinikinFont* minikinFont) {
    103     assertMinikinLocked();
    104     // TODO: get rid of nullFaceFont
    105     static hb_font_t* nullFaceFont = nullptr;
    106     if (minikinFont == nullptr) {
    107         if (nullFaceFont == nullptr) {
    108             nullFaceFont = hb_font_create(nullptr);
    109         }
    110         return hb_font_reference(nullFaceFont);
    111     }
    112 
    113     HbFontCache* fontCache = getFontCacheLocked();
    114     const int32_t fontId = minikinFont->GetUniqueId();
    115     hb_font_t* font = fontCache->get(fontId);
    116     if (font != nullptr) {
    117         return hb_font_reference(font);
    118     }
    119 
    120     hb_face_t* face;
    121     const void* buf = minikinFont->GetFontData();
    122     if (buf == nullptr) {
    123         face = hb_face_create_for_tables(referenceTable, minikinFont, nullptr);
    124     } else {
    125         size_t size = minikinFont->GetFontSize();
    126         hb_blob_t* blob = hb_blob_create(reinterpret_cast<const char*>(buf), size,
    127             HB_MEMORY_MODE_READONLY, nullptr, nullptr);
    128         face = hb_face_create(blob, minikinFont->GetFontIndex());
    129         hb_blob_destroy(blob);
    130     }
    131     hb_font_t* parent_font = hb_font_create(face);
    132     hb_ot_font_set_funcs(parent_font);
    133 
    134     unsigned int upem = hb_face_get_upem(face);
    135     hb_font_set_scale(parent_font, upem, upem);
    136 
    137     font = hb_font_create_sub_font(parent_font);
    138     hb_font_destroy(parent_font);
    139     hb_face_destroy(face);
    140     fontCache->put(fontId, font);
    141     return hb_font_reference(font);
    142 }

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

   1121 hb_font_t *
   1122 hb_font_create (hb_face_t *face)
   1123 {
   1124   hb_font_t *font;
   1125 
   1126   if (unlikely (!face))
   1127     face = hb_face_get_empty ();
   1128   if (!(font = hb_object_create<hb_font_t> ()))
   1129     return hb_font_get_empty ();
   1130 
   1131   hb_face_make_immutable (face);
   1132   font->parent = hb_font_get_empty ();
   1133   font->face = hb_face_reference (face);
   1134   font->klass = hb_font_funcs_get_empty ();
   1135 
   1136   font->x_scale = font->y_scale = hb_face_get_upem (face);
   1137 
   1138   return font;
   1139 }

Cross Reference: /external/harfbuzz_ng/src/hb-font.cc

   1181 hb_font_t *
   1182 hb_font_get_empty (void)
   1183 {
   1184   static const hb_font_t _hb_font_nil = {
   1185     HB_OBJECT_HEADER_STATIC,
   1186 
   1187     true, /* immutable */
   1188 
   1189     NULL, /* parent */
   1190     const_cast<hb_face_t *> (&_hb_face_nil),
   1191 
   1192     1000, /* x_scale */
   1193     1000, /* y_scale */
   1194 
   1195     0, /* x_ppem */
   1196     0, /* y_ppem */
   1197 
   1198     const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil), /* klass */
   1199     NULL, /* user_data */
   1200     NULL, /* destroy */
   1201 
   1202     {
   1203 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
   1204 #include "hb-shaper-list.hh"
   1205 #undef HB_SHAPER_IMPLEMENT
   1206     }
   1207   };
   1208 
   1209   return const_cast<hb_font_t *> (&_hb_font_nil);
   1210 }

Cross Reference: /external/harfbuzz_ng/src/hb-font.cc

   1222 hb_font_t *
   1223 hb_font_reference (hb_font_t *font)
   1224 {
   1225   return hb_object_reference (font);
   1226 }

Cross Reference: /external/harfbuzz_ng/src/hb-font.cc

    154 template <typename Type>
    155 static inline Type *hb_object_reference (Type *obj)
    156 {
    157   hb_object_trace (obj, HB_FUNC);
    158   if (unlikely (!obj || hb_object_is_inert (obj)))
    159     return obj;
    160   assert (hb_object_is_valid (obj));
    161   obj->header.ref_count.inc ();
    162   return obj;
    163 }

Cross Reference: /external/harfbuzz_ng/src/hb-object-private.hh