📄 pango-ot-info.c
字号:
HB_GDEF gdef = pango_ot_info_get_gdef (info); info->loaded |= INFO_LOADED_GPOS; if (is_truetype (info->face)) { error = HB_Load_GPOS_Table (info->face, &info->gpos, gdef); if (error && error != FT_Err_Table_Missing) g_warning ("Error loading GPOS table %d", error); } } return info->gpos;}static gbooleanget_tables (PangoOTInfo *info, PangoOTTableType table_type, HB_ScriptList **script_list, HB_FeatureList **feature_list){ if (table_type == PANGO_OT_TABLE_GSUB) { HB_GSUB gsub = pango_ot_info_get_gsub (info); if (!gsub) return FALSE; else { if (script_list) *script_list = &gsub->ScriptList; if (feature_list) *feature_list = &gsub->FeatureList; return TRUE; } } else { HB_GPOS gpos = pango_ot_info_get_gpos (info); if (!gpos) return FALSE; else { if (script_list) *script_list = &gpos->ScriptList; if (feature_list) *feature_list = &gpos->FeatureList; return TRUE; } }}/** * pango_ot_info_find_script: * @info: a #PangoOTInfo. * @table_type: the table type to obtain information about. * @script_tag: the tag of the script to find. * @script_index: location to store the index of the script, or %NULL. * * Finds the index of a script. * * Return value: %TRUE if the script was found. **/gbooleanpango_ot_info_find_script (PangoOTInfo *info, PangoOTTableType table_type, PangoOTTag script_tag, guint *script_index){ HB_ScriptList *script_list; int i; g_return_val_if_fail (PANGO_IS_OT_INFO (info), FALSE); if (!get_tables (info, table_type, &script_list, NULL)) return FALSE; for (i=0; i < script_list->ScriptCount; i++) { if (script_list->ScriptRecord[i].ScriptTag == script_tag) { if (script_index) *script_index = i; return TRUE; } } return FALSE;}/** * pango_ot_info_find_language: * @info: a #PangoOTInfo. * @table_type: the table type to obtain information about. * @script_index: the index of the script whose languages are searched. * @language_tag: the tag of the language to find. * @language_index: location to store the index of the language, or %NULL. * @required_feature_index: location to store the required feature index of * the language, or %NULL. * * Finds the index of a language and its required feature index. * * Return value: %TRUE if the language was found. **/gbooleanpango_ot_info_find_language (PangoOTInfo *info, PangoOTTableType table_type, guint script_index, PangoOTTag language_tag, guint *language_index, guint *required_feature_index){ HB_ScriptList *script_list; HB_Script *script; int i; g_return_val_if_fail (PANGO_IS_OT_INFO (info), FALSE); if (!get_tables (info, table_type, &script_list, NULL)) return FALSE; g_return_val_if_fail (script_index < script_list->ScriptCount, FALSE); script = &script_list->ScriptRecord[script_index].Script; for (i = 0; i < script->LangSysCount; i++) { if (script->LangSysRecord[i].LangSysTag == language_tag) { if (language_index) *language_index = i; if (required_feature_index) *required_feature_index = script->LangSysRecord[i].LangSys.ReqFeatureIndex; return TRUE; } } return FALSE;}/** * pango_ot_info_find_feature: * @info: a #PangoOTInfo. * @table_type: the table type to obtain information about. * @feature_tag: the tag of the feature to find. * @script_index: the index of the script. * @language_index: the index of the language whose features are searched, * or %PANGO_OT_DEFAULT_LANGUAGE to use the default language of the script. * @feature_index: location to store the index of the feature, or %NULL. * * Finds the index of a feature. * * Return value: %TRUE if the feature was found. **/gbooleanpango_ot_info_find_feature (PangoOTInfo *info, PangoOTTableType table_type, PangoOTTag feature_tag, guint script_index, guint language_index, guint *feature_index){ HB_ScriptList *script_list; HB_FeatureList *feature_list; HB_Script *script; HB_LangSys *lang_sys; int i; g_return_val_if_fail (PANGO_IS_OT_INFO (info), FALSE); if (!get_tables (info, table_type, &script_list, &feature_list)) return FALSE; g_return_val_if_fail (script_index < script_list->ScriptCount, FALSE); script = &script_list->ScriptRecord[script_index].Script; if (language_index == PANGO_OT_DEFAULT_LANGUAGE) lang_sys = &script->DefaultLangSys; else { g_return_val_if_fail (language_index < script->LangSysCount, FALSE); lang_sys = &script->LangSysRecord[language_index].LangSys; } for (i = 0; i < lang_sys->FeatureCount; i++) { FT_UShort index = lang_sys->FeatureIndex[i]; if (feature_list->FeatureRecord[index].FeatureTag == feature_tag) { if (feature_index) *feature_index = index; return TRUE; } } return FALSE;}/** * pango_ot_info_list_scripts: * @info: a #PangoOTInfo. * @table_type: the table type to obtain information about. * * Obtains the list of available scripts. * * Return value: a newly-allocated array containing the tags of the * available scripts. **/PangoOTTag *pango_ot_info_list_scripts (PangoOTInfo *info, PangoOTTableType table_type){ PangoOTTag *result; HB_ScriptList *script_list; int i; g_return_val_if_fail (PANGO_IS_OT_INFO (info), NULL); if (!get_tables (info, table_type, &script_list, NULL)) return NULL; result = g_new (PangoOTTag, script_list->ScriptCount + 1); for (i=0; i < script_list->ScriptCount; i++) result[i] = script_list->ScriptRecord[i].ScriptTag; result[i] = 0; return result;}/** * pango_ot_info_list_languages: * @info: a #PangoOTInfo. * @table_type: the table type to obtain information about. * @script_index: the index of the script to list languages for. * @language_tag: unused parameter. * * Obtains the list of available languages for a given script. * * Return value: a newly-allocated array containing the tags of the * available languages. **/PangoOTTag *pango_ot_info_list_languages (PangoOTInfo *info, PangoOTTableType table_type, guint script_index, PangoOTTag language_tag G_GNUC_UNUSED){ PangoOTTag *result; HB_ScriptList *script_list; HB_Script *script; int i; g_return_val_if_fail (PANGO_IS_OT_INFO (info), NULL); if (!get_tables (info, table_type, &script_list, NULL)) return NULL; g_return_val_if_fail (script_index < script_list->ScriptCount, NULL); script = &script_list->ScriptRecord[script_index].Script; result = g_new (PangoOTTag, script->LangSysCount + 1); for (i = 0; i < script->LangSysCount; i++) result[i] = script->LangSysRecord[i].LangSysTag; result[i] = 0; return result;}/** * pango_ot_info_list_features: * @info: a #PangoOTInfo. * @table_type: the table type to obtain information about. * @tag: unused parameter. * @script_index: the index of the script to obtain information about. * @language_index: the index of the language to list features for, or * %PANGO_OT_DEFAULT_LANGUAGE, to list features for the default * language of the script. * * Obtains the list of features for the given language of the given script. * * Return value: a newly-allocated array containing the tags of the * available features. **/PangoOTTag *pango_ot_info_list_features (PangoOTInfo *info, PangoOTTableType table_type, PangoOTTag tag G_GNUC_UNUSED, guint script_index, guint language_index){ PangoOTTag *result; HB_ScriptList *script_list; HB_FeatureList *feature_list; HB_Script *script; HB_LangSys *lang_sys; int i; g_return_val_if_fail (PANGO_IS_OT_INFO (info), NULL); if (!get_tables (info, table_type, &script_list, &feature_list)) return NULL; g_return_val_if_fail (script_index < script_list->ScriptCount, NULL); script = &script_list->ScriptRecord[script_index].Script; if (language_index == PANGO_OT_DEFAULT_LANGUAGE) lang_sys = &script->DefaultLangSys; else { g_return_val_if_fail (language_index < script->LangSysCount, NULL); lang_sys = &script->LangSysRecord[language_index].LangSys; } result = g_new (PangoOTTag, lang_sys->FeatureCount + 1); for (i = 0; i < lang_sys->FeatureCount; i++) { FT_UShort index = lang_sys->FeatureIndex[i]; result[i] = feature_list->FeatureRecord[index].FeatureTag; } result[i] = 0; return result;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -