[kern/kerx] Fix Format2 offsetting
"The values in the right class table are stored pre-multiplied by the number of bytes in a single kerning value, and the values in the left class table are stored pre-multiplied by the number of bytes in one row. This eliminates needing to multiply the row and column values together to determine the location of the kerning value. The array can be indexed by doing the right- and left-hand class mappings, adding the class values to the address of the array, and fetching the kerning value to which the new address points."
This commit is contained in:
parent
ed2a404272
commit
8aa83d97f9
|
@ -127,7 +127,7 @@ struct KerxSubTableFormat2
|
||||||
{
|
{
|
||||||
unsigned int l = (this+leftClassTable).get_class (left);
|
unsigned int l = (this+leftClassTable).get_class (left);
|
||||||
unsigned int r = (this+leftClassTable).get_class (left);
|
unsigned int r = (this+leftClassTable).get_class (left);
|
||||||
unsigned int offset = l * rowWidth + r * sizeof (FWORD);
|
unsigned int offset = l + r;
|
||||||
const FWORD *arr = &(this+array);
|
const FWORD *arr = &(this+array);
|
||||||
if (unlikely ((const void *) arr < (const void *) this || (const void *) arr >= (const void *) end))
|
if (unlikely ((const void *) arr < (const void *) this || (const void *) arr >= (const void *) end))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -118,7 +118,7 @@ struct KernSubTableFormat2
|
||||||
{
|
{
|
||||||
unsigned int l = (this+leftClassTable).get_class (left);
|
unsigned int l = (this+leftClassTable).get_class (left);
|
||||||
unsigned int r = (this+rightClassTable).get_class (right);
|
unsigned int r = (this+rightClassTable).get_class (right);
|
||||||
unsigned int offset = l * rowWidth + r * sizeof (FWORD);
|
unsigned int offset = l + r;
|
||||||
const FWORD *arr = &(this+array);
|
const FWORD *arr = &(this+array);
|
||||||
if (unlikely ((const void *) arr < (const void *) this || (const void *) arr >= (const void *) end))
|
if (unlikely ((const void *) arr < (const void *) this || (const void *) arr >= (const void *) end))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue