mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Fix test
This commit is contained in:
@ -84,7 +84,7 @@ public:
|
|||||||
|
|
||||||
/* fonts */
|
/* fonts */
|
||||||
const char *fonts_paths[NUM_EXAMPLES] = {
|
const char *fonts_paths[NUM_EXAMPLES] = {
|
||||||
"C:/Windows/Fonts/arial.ttf",
|
"C:/Windows/Fonts/calibri.ttf",
|
||||||
//"C:/Windows/Fonts/arial.ttf",
|
//"C:/Windows/Fonts/arial.ttf",
|
||||||
"C:/Users/korol/AppData/Local/Microsoft/Windows/Fonts/ArabicTest.ttf",
|
"C:/Users/korol/AppData/Local/Microsoft/Windows/Fonts/ArabicTest.ttf",
|
||||||
"C:/Windows/Fonts/simsun.ttc"
|
"C:/Windows/Fonts/simsun.ttc"
|
||||||
@ -95,7 +95,7 @@ const char *num_glyph_types[NUM_GLYPH_TYPES] = {"UNCLASSIFIED", "BASE_GLYPH", "L
|
|||||||
|
|
||||||
/* tranlations courtesy of google */
|
/* tranlations courtesy of google */
|
||||||
const char *texts[NUM_EXAMPLES] = {
|
const char *texts[NUM_EXAMPLES] = {
|
||||||
"hello",
|
"fi",
|
||||||
"لا لآ لأ لا",
|
"لا لآ لأ لا",
|
||||||
"懶惰的姜貓"
|
"懶惰的姜貓"
|
||||||
};
|
};
|
||||||
@ -107,7 +107,7 @@ const hb_direction_t text_directions[NUM_EXAMPLES] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const int text_skip[NUM_EXAMPLES] = {
|
const int text_skip[NUM_EXAMPLES] = {
|
||||||
1,
|
0,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
};
|
};
|
||||||
@ -435,6 +435,11 @@ static void print_layout_info_using_private_api(hb_blob_t *blob)
|
|||||||
/* end of private API use */
|
/* end of private API use */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct hb_feature_test {
|
||||||
|
hb_tag_t tag;
|
||||||
|
uint32_t value;
|
||||||
|
};
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// hb_blob_t* blobFileTest = hb_blob_create_from_file("C:/Windows/Fonts/calibri.ttf");
|
// hb_blob_t* blobFileTest = hb_blob_create_from_file("C:/Windows/Fonts/calibri.ttf");
|
||||||
@ -499,28 +504,34 @@ int main(int argc, char *argv[])
|
|||||||
hb_buffer_set_language(buf, hb_language_from_string(languages[i], strlen(languages[i])));
|
hb_buffer_set_language(buf, hb_language_from_string(languages[i], strlen(languages[i])));
|
||||||
// hb_buffer_set_cluster_level (buf, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES);
|
// hb_buffer_set_cluster_level (buf, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES);
|
||||||
// hb_buffer_set_cluster_level (buf, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
|
// hb_buffer_set_cluster_level (buf, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
|
||||||
hb_buffer_set_cluster_level(buf, HB_BUFFER_CLUSTER_LEVEL_CHARACTERS);
|
hb_buffer_set_cluster_level(buf, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES);
|
||||||
|
|
||||||
#if 0
|
hb_feature_test features[] {
|
||||||
#define userfeatures_count 4
|
{HB_TAG('r','l','i','g'), 1},
|
||||||
hb_feature_t userfeatures[userfeatures_count];
|
{HB_TAG('l','i','g','a'), 0},
|
||||||
hb_tag_t tags[] = {
|
{HB_TAG('c','l','i','g'), 1},
|
||||||
HB_TAG('l','i','g','a'),
|
{HB_TAG('h','l','i','g'), 1},
|
||||||
HB_TAG('c','l','i','g'),
|
{HB_TAG('d','l','i','g'), 1},
|
||||||
HB_TAG('d','l','i','g'),
|
{HB_TAG('k','e','r','n'), 2},
|
||||||
HB_TAG('h','l','i','g'),
|
{0, 0}
|
||||||
};
|
};
|
||||||
for (int f = 0; f < userfeatures_count; f++)
|
|
||||||
{
|
int userfeatures_count = 0;
|
||||||
userfeatures[f].tag = tags[f];
|
hb_feature_t userfeatures[100];
|
||||||
userfeatures[f].value = 1;
|
|
||||||
userfeatures[f].start = HB_FEATURE_GLOBAL_START;
|
hb_feature_test* current_feature = features;
|
||||||
userfeatures[f].end = HB_FEATURE_GLOBAL_END;
|
while (current_feature->tag != 0)
|
||||||
}
|
{
|
||||||
#else
|
if (current_feature->value != 2)
|
||||||
#define userfeatures_count 0
|
{
|
||||||
hb_feature_t *userfeatures = NULL;
|
userfeatures[userfeatures_count].tag = current_feature->tag;
|
||||||
#endif
|
userfeatures[userfeatures_count].value = current_feature->value;
|
||||||
|
userfeatures[userfeatures_count].start = HB_FEATURE_GLOBAL_START;
|
||||||
|
userfeatures[userfeatures_count].end = HB_FEATURE_GLOBAL_END;
|
||||||
|
userfeatures_count++;
|
||||||
|
}
|
||||||
|
current_feature++;
|
||||||
|
}
|
||||||
|
|
||||||
/* Layout the text */
|
/* Layout the text */
|
||||||
hb_buffer_add_utf8(buf, texts[i], strlen(texts[i]), 0, strlen(texts[i]));
|
hb_buffer_add_utf8(buf, texts[i], strlen(texts[i]), 0, strlen(texts[i]));
|
||||||
@ -531,7 +542,7 @@ int main(int argc, char *argv[])
|
|||||||
// const char*const pHbShapers[] = { "graphite2", "coretext_aat", "ot", "fallback", nullptr };
|
// const char*const pHbShapers[] = { "graphite2", "coretext_aat", "ot", "fallback", nullptr };
|
||||||
// bool ok = hb_shape_full(hb_ft_font[i], buf, userfeatures, userfeatures_count, pHbShapers);
|
// bool ok = hb_shape_full(hb_ft_font[i], buf, userfeatures, userfeatures_count, pHbShapers);
|
||||||
|
|
||||||
hb_shape(hb_ft_font[i], buf, userfeatures, userfeatures_count);
|
hb_shape(hb_ft_font[i], buf, (userfeatures_count != 0) ? userfeatures : NULL, userfeatures_count);
|
||||||
|
|
||||||
unsigned int glyph_count;
|
unsigned int glyph_count;
|
||||||
hb_glyph_info_t *glyph_info = hb_buffer_get_glyph_infos(buf, &glyph_count);
|
hb_glyph_info_t *glyph_info = hb_buffer_get_glyph_infos(buf, &glyph_count);
|
||||||
|
|||||||
Reference in New Issue
Block a user