Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Commit3f1890b
committed
Rework mapping of dvi glyph indices to freetype indices.
In89a7e19, an API for converting "dvi glyph indices" (as storedin a dvi file) to FreeType-compatible keys (either "indices intothe native charmap" or "glyph names") was introduced. It wasintended that end users (i.e., backends) would check the type of`text.glyph_name_or_index` ((A) int or (B) str) and load the glyphaccordingly ((A) `FT_Set_Charmap(native_cmap); FT_Load_Char(index);` or(B) `FT_Load_Glyph(FT_Get_Name_Index(name));`); however, with the futureintroduction of {xe,lua}tex support, this kind of type checking becomesinconvenient, because {xe,lua}tex's "dvi glyph indices", which aredirectly equal to FreeType glyph indices (i.e. they would be loaded with`FT_Load_Glyph(index);`), would normally also be converted to ints.This PR introduces a new API (`_index_dvi_to_freetype`) to performthis mapping, always mapping to FreeType glyph indices (i.e. onecan always just call `FT_Load_Glyph` on the result). To do so,in case (A) it loads itself the native charmap (something theend user needed to do by themselves previously) and performs thecmap-to-index conversion (`FT_Get_Char_Index`) previously implicitin `FT_Load_Char`; in case (B) it performs itself the name-to-indexconversion (`FT_Get_Name_Index`). When {xe,lua}tex support isintroduced in the future, `_index_dvi_to_freetype` will just return theindex as is. Note that this API is intentionally kept private for now(even though it is used by textpath) and the old APIs are not deprecatedyet; I intend to wait until {xe,lua}tex support is actually merged to doso, to avoid possible future back-and-forth changes on the public APIs.In case (A), this PR also improves on the detection of the nativecharmap, which was previously detected via heuristics(`_select_native_charmap`), but is now read by directly accessing theType 1 font "encoding vector".1 parentdc05767 commit3f1890b
File tree
3 files changed
+65
-39
lines changed- lib/matplotlib
- src
3 files changed
+65
-39
lines changedLines changed: 35 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
33 |
| - | |
| 33 | + | |
34 | 34 |
| |
35 | 35 |
| |
36 | 36 |
| |
| |||
578 | 578 |
| |
579 | 579 |
| |
580 | 580 |
| |
581 |
| - | |
| 581 | + | |
582 | 582 |
| |
583 | 583 |
| |
584 | 584 |
| |
| |||
587 | 587 |
| |
588 | 588 |
| |
589 | 589 |
| |
| 590 | + | |
590 | 591 |
| |
591 | 592 |
| |
592 | 593 |
| |
| |||
631 | 632 |
| |
632 | 633 |
| |
633 | 634 |
| |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
634 | 664 |
| |
635 | 665 |
| |
636 | 666 |
| |
| |||
1002 | 1032 |
| |
1003 | 1033 |
| |
1004 | 1034 |
| |
1005 |
| - | |
1006 |
| - | |
| 1035 | + | |
1007 | 1036 |
| |
1008 | 1037 |
| |
1009 | 1038 |
| |
| |||
1134 | 1163 |
| |
1135 | 1164 |
| |
1136 | 1165 |
| |
1137 |
| - | |
1138 | 1166 |
| |
1139 | 1167 |
| |
1140 |
| - | |
1141 |
| - | |
1142 |
| - | |
1143 |
| - | |
1144 |
| - | |
1145 |
| - | |
| 1168 | + | |
| 1169 | + | |
1146 | 1170 |
| |
1147 | 1171 |
| |
1148 | 1172 |
| |
|
Lines changed: 2 additions & 28 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
238 | 238 |
| |
239 | 239 |
| |
240 | 240 |
| |
241 |
| - | |
242 |
| - | |
243 |
| - | |
244 |
| - | |
245 |
| - | |
246 |
| - | |
247 |
| - | |
248 |
| - | |
249 |
| - | |
250 |
| - | |
251 |
| - | |
| 241 | + | |
| 242 | + | |
252 | 243 |
| |
253 | 244 |
| |
254 | 245 |
| |
| |||
269 | 260 |
| |
270 | 261 |
| |
271 | 262 |
| |
272 |
| - | |
273 |
| - | |
274 |
| - | |
275 |
| - | |
276 |
| - | |
277 |
| - | |
278 |
| - | |
279 |
| - | |
280 |
| - | |
281 |
| - | |
282 |
| - | |
283 |
| - | |
284 |
| - | |
285 |
| - | |
286 |
| - | |
287 |
| - | |
288 |
| - | |
289 | 263 |
| |
290 | 264 |
| |
291 | 265 |
| |
|
Lines changed: 28 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1431 | 1431 |
| |
1432 | 1432 |
| |
1433 | 1433 |
| |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
1434 | 1460 |
| |
1435 | 1461 |
| |
1436 | 1462 |
| |
| |||
1761 | 1787 |
| |
1762 | 1788 |
| |
1763 | 1789 |
| |
| 1790 | + | |
| 1791 | + | |
1764 | 1792 |
| |
1765 | 1793 |
| |
1766 | 1794 |
| |
|
0 commit comments
Comments
(0)