@@ -952,6 +952,19 @@ local function initializeprotrusion(tfmdata, value)
952952 end
953953 return
954954 end
955+ local lookup = {}
956+ local name_to_index = tfmdata .resources .unicodes
957+ for k , v in next , setup do
958+ local ktype = type (k )
959+ if ktype == ' number' then
960+ lookup [k ] = v
961+ elseif ktype == ' string' then
962+ local index = name_to_index [k ]
963+ if index then
964+ lookup [index ] = v
965+ end
966+ end
967+ end
955968 local quad = tfmdata .parameters .quad
956969 local factor = setup .factor or 1
957970 if quad ~= 0 then
@@ -961,7 +974,7 @@ local function initializeprotrusion(tfmdata, value)
961974 local right = factor * (setup .right or 1 )
962975 for i , chr in next , tfmdata .characters do
963976 local width = chr .width or 0
964- local v , pl , pr = setup [i ], nil , nil
977+ local v , pl , pr = lookup [i ], nil , nil
965978 if v then
966979 pl , pr = v [1 ], v [2 ]
967980 end
@@ -989,12 +1002,25 @@ local function initializeexpansion(tfmdata, value)
9891002 end
9901003 return
9911004 end
1005+ local lookup = {}
1006+ local name_to_index = tfmdata .resources .unicodes
1007+ for k , v in next , setup do
1008+ local ktype = type (k )
1009+ if ktype == ' number' then
1010+ lookup [k ] = v
1011+ elseif ktype == ' string' then
1012+ local index = name_to_index [k ]
1013+ if index then
1014+ lookup [index ] = v
1015+ end
1016+ end
1017+ end
9921018 local factor = 1000 * (setup .factor or 1 )
9931019 tfmdata .stretch = 10 * (setup .stretch or 0 )
9941020 tfmdata .shrink = 10 * (setup .shrink or 0 )
9951021 tfmdata .step = 10 * (setup .step or 0 )
9961022 for i , chr in next , tfmdata .characters do
997- local v = setup [i ]
1023+ local v = lookup [i ]
9981024 if v and v ~= 0 then
9991025 chr .expansion_factor = v * factor
10001026 elseif factor ~= 1000 then
0 commit comments