[kern] More tweaks
Solves a mystery or two. I'm fairly confident this is what CoreText does now.
This commit is contained in:
parent
564e8ac046
commit
80a33b9ac3
|
@ -266,15 +266,27 @@ struct KernSubTableFormat1
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_mask_t kern_mask = c->plan->kern_mask;
|
hb_mask_t kern_mask = c->plan->kern_mask;
|
||||||
while (depth--)
|
|
||||||
{
|
|
||||||
unsigned int idx = stack[depth];
|
|
||||||
int v = *actions++;
|
|
||||||
|
|
||||||
/* The following two flags are undocumented in the spec, but described
|
/* "Each pops one glyph from the kerning stack and applies the kerning value to it.
|
||||||
* in the example. */
|
* The end of the list is marked by an odd value... */
|
||||||
bool last = v & 1;
|
unsigned int i;
|
||||||
|
for (i = 0; i < depth; i++)
|
||||||
|
if (actions[i] & 1)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (; i; i--)
|
||||||
|
{
|
||||||
|
unsigned int idx = stack[depth - i];
|
||||||
|
int v = actions[i - 1];
|
||||||
|
|
||||||
|
/* "The end of the list is marked by an odd value..."
|
||||||
|
* Ignore it. */
|
||||||
v &= ~1;
|
v &= ~1;
|
||||||
|
|
||||||
|
/* The following flag is undocumented in the spec, but described
|
||||||
|
* in the example. */
|
||||||
if (v == 0x8000)
|
if (v == 0x8000)
|
||||||
{
|
{
|
||||||
crossOffset = 0;
|
crossOffset = 0;
|
||||||
|
@ -287,11 +299,9 @@ struct KernSubTableFormat1
|
||||||
{
|
{
|
||||||
if (crossStream)
|
if (crossStream)
|
||||||
{
|
{
|
||||||
|
crossOffset += v;
|
||||||
if (!buffer->pos[idx].y_offset)
|
if (!buffer->pos[idx].y_offset)
|
||||||
buffer->pos[idx].y_offset += c->font->em_scale_y (crossOffset);
|
buffer->pos[idx].y_offset += c->font->em_scale_y (crossOffset);
|
||||||
/* XXX Why negative, not positive?!?! */
|
|
||||||
v = -v;
|
|
||||||
crossOffset += v;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -307,13 +317,9 @@ struct KernSubTableFormat1
|
||||||
if (crossStream)
|
if (crossStream)
|
||||||
{
|
{
|
||||||
/* CoreText doesn't do crossStream kerning in vertical. */
|
/* CoreText doesn't do crossStream kerning in vertical. */
|
||||||
#if 0
|
//crossOffset += v;
|
||||||
if (!buffer->pos[idx].x_offset)
|
//if (!buffer->pos[idx].x_offset)
|
||||||
buffer->pos[idx].x_offset = c->font->em_scale_x (crossOffset);
|
// buffer->pos[idx].x_offset = c->font->em_scale_x (crossOffset);
|
||||||
#endif
|
|
||||||
/* XXX Why negative, not positive?!?! */
|
|
||||||
v = -v;
|
|
||||||
crossOffset += v;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -325,8 +331,6 @@ struct KernSubTableFormat1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (last)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
depth = 0;
|
depth = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue