Skip to content

Commit c2bf1c2

Browse files
committed
Disallow IFT fonts that have two tables with the same compat ID.
1 parent a7f1057 commit c2bf1c2

File tree

2 files changed

+27
-24
lines changed

2 files changed

+27
-24
lines changed

Overview.bs

+17-16
Original file line numberDiff line numberDiff line change
@@ -426,21 +426,22 @@ The algorithm:
426426
either table is not valid, invoke [$Handle errors$]. If <var>extended font subset</var> does not have an 'IFT ' table, then it is
427427
not an [=incremental font=] and cannot be extended, return <var>extended font subset</var>.
428428

429-
3. For each of [[open-type/otff#table-directory|tables]] 'IFT ' and 'IFTX' (if present): convert the table into a list of entries by
429+
3. If the compatibility ID in 'IFT ' is equal to the compatibility ID in 'IFTX' this is an error, invoke [$Handle errors$].
430+
431+
4. For each of [[open-type/otff#table-directory|tables]] 'IFT ' and 'IFTX' (if present): convert the table into a list of entries by
430432
invoking [$Interpret Format 1 Patch Map$] or [$Interpret Format 2 Patch Map$]. Concatenate the returned entry lists into a single list,
431433
<var>entry list</var>.
432434

433-
434-
4. For each <var>entry</var> in <var>entry list</var> invoke [$Check entry intersection$] with <var>entry</var> and
435+
5. For each <var>entry</var> in <var>entry list</var> invoke [$Check entry intersection$] with <var>entry</var> and
435436
<var>target subset definition</var> as inputs, if it returns false remove <var>entry</var>
436437
from <var>entry list</var>.
437438

438-
5. Remove any entries in <var>entry list</var> which have a patch URI which was loaded and applied previously during the execution
439+
6. Remove any entries in <var>entry list</var> which have a patch URI which was loaded and applied previously during the execution
439440
of this algorithm.
440441

441-
6. If <var>entry list</var> is empty, then the extension operation is finished, return <var>extended font subset</var>.
442+
7. If <var>entry list</var> is empty, then the extension operation is finished, return <var>extended font subset</var>.
442443

443-
7. Pick one <var>entry</var> from <var>entry list</var> with the following procedure:
444+
8. Pick one <var>entry</var> from <var>entry list</var> with the following procedure:
444445

445446
* If <var>entry list</var> contains one or more [=patch map entries=] which have a patch format that is [=Full Invalidation=]
446447
then, select exactly one of the [=Full Invalidation=] entries in <var>entry list</var>. Follow the criteria in
@@ -453,7 +454,7 @@ The algorithm:
453454
* Otherwise select exactly one of the [=No Invalidation=] entries in <var>entry list</var>.
454455
The criteria for selecting the single entry is left up to the implementation to decide.
455456

456-
8. Load <var>patch file</var> by invoking [$Load patch file$] with the <var>initial font subset URI</var> as the initial font URI and
457+
9. Load <var>patch file</var> by invoking [$Load patch file$] with the <var>initial font subset URI</var> as the initial font URI and
457458
the <var>entry</var> patch URI as the patch URI. The total number of patches that a client can load and apply during a single execution
458459
of this algorithm is limited to:
459460

@@ -464,15 +465,15 @@ The algorithm:
464465
Can be loaded and applied during a single invocation of this algorithm. If either count has been exceeded this is an error invoke
465466
[$Handle errors$].
466467

467-
9. Apply <var>patch file</var> using the appropriate application algorithm (matching the patches format in <var>entry</var>) from
468-
[[#font-patch-formats]] to apply the <var>patch file</var> using the patch URI and the compatibility id from <var>entry</var> to
469-
<var>extended font subset</var>.
468+
10. Apply <var>patch file</var> using the appropriate application algorithm (matching the patches format in <var>entry</var>) from
469+
[[#font-patch-formats]] to apply the <var>patch file</var> using the patch URI and the compatibility id from <var>entry</var> to
470+
<var>extended font subset</var>.
470471

471-
10. Go to step 2.
472+
11. Go to step 2.
472473

473474
Note: the algorithm here presents patch loads as being done one at a time; however, to improve performance client implementations are
474475
encouraged to pre-fetch patch files that will be applied in later iterations by the algorithm. The
475-
[[#font-patch-invalidations|invalidation categories]] can be used to predict which intersecting patches from step 4 will remain be valid
476+
[[#font-patch-invalidations|invalidation categories]] can be used to predict which intersecting patches from step 5 will remain be valid
476477
to be applied. For example: in a case where there are only "No Invalidation" intersecting patches the client could safely load all
477478
intersecting patches in parallel, since no patch application will invalidate any of the other intersecting patches.
478479

@@ -700,7 +701,7 @@ patch entry from a list of candidate entries. The selection criteria used has a
700701
perform the extension. Round trips are costly so for maximum performance patches should be selected in a way that minimizes the total number of needed
701702
round trips.
702703

703-
The following selection criteria minimizes round trips and must be used by the client when selecting a single partial or full invalidation patch in step 7
704+
The following selection criteria minimizes round trips and must be used by the client when selecting a single partial or full invalidation patch in step 8
704705
of [$Extend an Incremental Font Subset$]:
705706

706707
1. For each candidate entry compute the set intersection between each subset definition in the entry and the target subset definition. Union
@@ -755,7 +756,7 @@ parts of some content an incremental font can render:
755756
0 then the incremental font does not fully support rendering the shaping unit.
756757

757758
* Second, compute the corresponding [=font subset definition=] and execute the [$Extend an Incremental Font Subset$] algorithm,
758-
stopping at step 6. If the entry list is not empty then the incremental font does not fully support rendering the shaping unit.
759+
stopping at step 7. If the entry list is not empty then the incremental font does not fully support rendering the shaping unit.
759760

760761
* Any shaping units that passed both checks can be rendered in their entirety with the font.
761762

@@ -804,7 +805,7 @@ def supported_spans(shaping_unit, ift_font):
804805
def supports_subset_def(ift_font, subset_def):
805806
# Return true only if both of the following two checks are true:
806807
# - Each code point in subset_def is mapped to a glyph id other than '0' by ift_font's cmap table.
807-
# - After executing the "Extend an Incremental Font Subset" algorithm on ift_font with subset_def and stopping at step 6 the
808+
# - After executing the "Extend an Incremental Font Subset" algorithm on ift_font with subset_def and stopping at step 7 the
808809
# entry list is empty.
809810
</pre>
810811

@@ -2294,7 +2295,7 @@ The [=incremental font=] and associated patches produced by a compliant encoder:
22942295

22952296
2. Must be consistent, that is: for any possible [=font subset definition=] the result of invoking [$Extend an Incremental Font Subset$]
22962297
with that subset definition and the [=incremental font=] must always be the same regardless of the particular order
2297-
of patch selection chosen in step 7 of [$Extend an Incremental Font Subset$].
2298+
of patch selection chosen in step 8 of [$Extend an Incremental Font Subset$].
22982299

22992300
3. Must respect patch invalidation criteria. Any patch which is part of an IFT encoding when applied to a compatible [=font subset=]
23002301
must only make changes to the [=patch map=] compatibility IDs which are compliant with the [[#font-patch-invalidations]] criteria

0 commit comments

Comments
 (0)