* src/type1/t1afm.c (T1_Read_PFM): Set charmaps directly.

As with the previous commit, we can avoid the validation checks
of `FT_Set_Charmap` and set it directly when choosing from the
available list.
This commit is contained in:
Alexei Podtelezhnikov 2022-10-03 19:18:48 -04:00
parent 8faf57dd17
commit 1b6dce84f9
1 changed files with 2 additions and 8 deletions

View File

@ -178,7 +178,6 @@
/* temporarily. If we find no PostScript charmap, then just use */ /* temporarily. If we find no PostScript charmap, then just use */
/* the default and hope it is the right one. */ /* the default and hope it is the right one. */
oldcharmap = t1_face->charmap; oldcharmap = t1_face->charmap;
charmap = NULL;
for ( n = 0; n < t1_face->num_charmaps; n++ ) for ( n = 0; n < t1_face->num_charmaps; n++ )
{ {
@ -186,9 +185,7 @@
/* check against PostScript pseudo platform */ /* check against PostScript pseudo platform */
if ( charmap->platform_id == 7 ) if ( charmap->platform_id == 7 )
{ {
error = FT_Set_Charmap( t1_face, charmap ); t1_face->charmap = charmap;
if ( error )
goto Exit;
break; break;
} }
} }
@ -209,10 +206,7 @@
kp++; kp++;
} }
if ( oldcharmap ) t1_face->charmap = oldcharmap;
error = FT_Set_Charmap( t1_face, oldcharmap );
if ( error )
goto Exit;
/* now, sort the kern pairs according to their glyph indices */ /* now, sort the kern pairs according to their glyph indices */
ft_qsort( fi->KernPairs, fi->NumKernPair, sizeof ( AFM_KernPairRec ), ft_qsort( fi->KernPairs, fi->NumKernPair, sizeof ( AFM_KernPairRec ),