Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

Avoid more than one inrange when there’s no overlap #401

Merged
merged 1 commit into from
Feb 3, 2017
Merged

Avoid more than one inrange when there’s no overlap #401

merged 1 commit into from
Feb 3, 2017

Conversation

zhouyan
Copy link

@zhouyan zhouyan commented Feb 2, 2017

The original will lead to more than one matched range even when there's no overlap among size ranges. This will happen when the asked size is exactly on the boundary (without any rounding errors).

If we strictly stick to the definition of optical range as in an Open-Closed interval, then this will lead to incorrect behavior.

But I am in doubt of this. The OpenType optical range is specified as Open-Closed, so that there's no overlap between adjacent intervals. However, say one is (3, 5] with design size 4, and another is (5, 6] with design size 5.5. At 5 point, the strict interpretation leads to (3, 5], which is the result of this pull request. However, it is closer to 5.5, the design size of the next range. It makes perfect sense to select the "wrong" interval to get better results.

This issue did not shown in previous tests I had done, because without #400, and all previous versions, there's always some rounding error. Admittedly they are extremely small (less than 1sp). Yet it prevented the situation where an asked size is exactly on boundary.

Also, for most optical fonts (not many out there anyway), this pull request makes no difference. Since in most optical fonts, the intervals get larger as the design size grows. So by measuring distance as asked size - center of interval, it's always closer to the lower range. And thus the upper bound of the it will be chosen anyway, even if there's two matched ones.

This only become a problem with fonts with very dense partitions among small sizes, and results in a lower range have a bigger interval than the next one. I only know LM and Arno have such issues.

@eroux
Copy link
Member

eroux commented Feb 2, 2017

Well, I think sticking to the rules defined by the font itself is definitely what people will expect, so I think this PR is ok...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants