Commits:
-
1bae8dcc
by Alexei Podtelezhnikov at 2022-11-11T11:26:35-05:00
[ftbench] Fix up charmap benchmarking.
* src/ftbench.c (main): Parse and process the charmap index option.
(header): Report the active charmap index.
(usage): Document it.
(test_cmap_cache): Call `FTC_CMapCache_Lookup` with correct argument.
(test_cmap_iter): Do not count idle charmaps.
* man/ftbench.1: Document the charmap selection.
2 changed files:
Changes:
man/ftbench.1
... |
... |
@@ -72,6 +72,12 @@ Use at most |
72
|
72
|
iterations for each test (0 means time limited).
|
73
|
73
|
.
|
74
|
74
|
.TP
|
|
75
|
+.BI \-e \ e
|
|
76
|
+Use charmap with index
|
|
77
|
+.I e
|
|
78
|
+instead of the default unicode.
|
|
79
|
+.
|
|
80
|
+.TP
|
75
|
81
|
.BI \-f \ l
|
76
|
82
|
Use
|
77
|
83
|
.B hexadecimal
|
... |
... |
@@ -105,7 +111,7 @@ Forward or reverse range of glyph indices to use |
105
|
111
|
(default is from 0 to the number of glyphs minus one).
|
106
|
112
|
.
|
107
|
113
|
.TP
|
108
|
|
-.BI \-m \ m
|
|
114
|
+.BI \-m \ M
|
109
|
115
|
Set maximum cache size to
|
110
|
116
|
.I M
|
111
|
117
|
KiByte (default is 1024).
|
src/ftbench.c
... |
... |
@@ -149,6 +149,8 @@ |
149
|
149
|
static int last_index = INT_MAX;
|
150
|
150
|
static int incr_index = 1;
|
151
|
151
|
|
|
152
|
+ static int cmap_index = -1;
|
|
153
|
+
|
152
|
154
|
#define FOREACH( i ) for ( i = first_index ; \
|
153
|
155
|
( first_index <= i && i <= last_index ) || \
|
154
|
156
|
( first_index >= i && i >= last_index ) ; \
|
... |
... |
@@ -608,7 +610,7 @@ |
608
|
610
|
{
|
609
|
611
|
if ( FTC_CMapCache_Lookup( cmap_cache,
|
610
|
612
|
font_type.face_id,
|
611
|
|
- 0,
|
|
613
|
+ cmap_index,
|
612
|
614
|
charset->code[i] ) )
|
613
|
615
|
done++;
|
614
|
616
|
}
|
... |
... |
@@ -700,6 +702,7 @@ |
700
|
702
|
{
|
701
|
703
|
FT_UInt idx;
|
702
|
704
|
FT_ULong charcode;
|
|
705
|
+ int done;
|
703
|
706
|
|
704
|
707
|
FT_UNUSED( user_data );
|
705
|
708
|
|
... |
... |
@@ -707,12 +710,14 @@ |
707
|
710
|
TIMER_START( timer );
|
708
|
711
|
|
709
|
712
|
charcode = FT_Get_First_Char( face, &idx );
|
|
713
|
+ done = ( idx != 0 );
|
|
714
|
+
|
710
|
715
|
while ( idx != 0 )
|
711
|
716
|
charcode = FT_Get_Next_Char( face, charcode, &idx );
|
712
|
717
|
|
713
|
718
|
TIMER_STOP( timer );
|
714
|
719
|
|
715
|
|
- return 1;
|
|
720
|
+ return done;
|
716
|
721
|
}
|
717
|
722
|
|
718
|
723
|
|
... |
... |
@@ -889,12 +894,14 @@ |
889
|
894
|
"driver: %s %s\n"
|
890
|
895
|
"target: %s\n"
|
891
|
896
|
" flags: 0x%X\n"
|
|
897
|
+ " cmap: %d\n"
|
892
|
898
|
"glyphs: %ld\n",
|
893
|
899
|
face->family_name,
|
894
|
900
|
face->style_name,
|
895
|
901
|
module_name, hinting_engine,
|
896
|
902
|
target,
|
897
|
903
|
load_flags,
|
|
904
|
+ FT_Get_Charmap_Index( face->charmap ),
|
898
|
905
|
face->num_glyphs );
|
899
|
906
|
}
|
900
|
907
|
|
... |
... |
@@ -1004,6 +1011,7 @@ |
1004
|
1011
|
" -C Compare with cached version (if available).\n"
|
1005
|
1012
|
" -c N Use at most N iterations for each test\n"
|
1006
|
1013
|
" (0 means time limited).\n"
|
|
1014
|
+ " -e E Set specific charmap index E.\n"
|
1007
|
1015
|
" -f L Use hex number L as load flags (see `FT_LOAD_XXX').\n"
|
1008
|
1016
|
" -H NAME Use PS hinting engine NAME.\n"
|
1009
|
1017
|
" Available versions are %s; default is `%s'.\n"
|
... |
... |
@@ -1141,7 +1149,7 @@ |
1141
|
1149
|
int opt;
|
1142
|
1150
|
|
1143
|
1151
|
|
1144
|
|
- opt = getopt( argc, argv, "b:Cc:f:H:I:i:l:m:pr:s:t:v" );
|
|
1152
|
+ opt = getopt( argc, argv, "b:Cc:e:f:H:I:i:l:m:pr:s:t:v" );
|
1145
|
1153
|
|
1146
|
1154
|
if ( opt == -1 )
|
1147
|
1155
|
break;
|
... |
... |
@@ -1162,6 +1170,10 @@ |
1162
|
1170
|
max_iter = -max_iter;
|
1163
|
1171
|
break;
|
1164
|
1172
|
|
|
1173
|
+ case 'e':
|
|
1174
|
+ cmap_index = atoi( optarg );
|
|
1175
|
+ break;
|
|
1176
|
+
|
1165
|
1177
|
case 'f':
|
1166
|
1178
|
load_flags = strtol( optarg, NULL, 16 );
|
1167
|
1179
|
break;
|
... |
... |
@@ -1323,6 +1335,11 @@ |
1323
|
1335
|
putchar( '-' );
|
1324
|
1336
|
putchar( '\n' );
|
1325
|
1337
|
|
|
1338
|
+ if ( cmap_index >= face->num_charmaps )
|
|
1339
|
+ cmap_index = -1;
|
|
1340
|
+ if ( cmap_index >= 0 )
|
|
1341
|
+ face->charmap = face->charmaps[cmap_index];
|
|
1342
|
+
|
1326
|
1343
|
header( face );
|
1327
|
1344
|
|
1328
|
1345
|
if ( !face->num_glyphs )
|
|