static SkTypeface* find_typeface(const char name[], SkTypeface::Style style) { NameFamilyPair* list = gNameList.begin(); int count = gNameList.count(); int index = SkStrLCSearch(&list[0].fName, count, name, sizeof(list[0])); if (index >= 0) { return find_best_face(list[index].fFamily, style); } return NULL; }
static void add_name(const char name[], FamilyRec* family) { SkAutoAsciiToLC tolc(name); name = tolc.lc(); NameFamilyPair* list = gNameList.begin(); int count = gNameList.count(); int index = SkStrLCSearch(&list[0].fName, count, name, sizeof(list[0])); if (index < 0) { list = gNameList.insert(~index); list->construct(name, family); } }
int SkStrLCSearch(const char*const* base, int count, const char target[], size_t elemSize) { return SkStrLCSearch(base, count, target, strlen(target), elemSize); }
static FamilyRec* find_familyrec(const char name[]) { const NameFamilyPair* list = gNameList.begin(); int index = SkStrLCSearch(&list[0].fName, gNameList.count(), name, sizeof(list[0])); return index >= 0 ? list[index].fFamily : NULL; }