Introduction
tfm tfm-validate
T
E
X Live
Conclusion
T
E
X Font Metrics Validation: Application to T
E
X Live
e TUG 2024 E
Didier Verna
EPITA / LRE
didier@lrde.epita.fr
lrde/~didier
@didierverna
didier.verna
in/didierverna
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
Conclusion
I
TFM font validator for T
E
X Live: https://texlive.info/tfm-validate/
I
Updated daily
I
Currently nding 770 fonts with oddities w.r.t. the standard
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 2/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
The tfm Library
I
Part of ETAP
I
Bring T
E
X Font Metrics information to Common Lisp
Entry Point
CL-USER> (tfm:load-font ".../cmr10.tfm")
#<TFM:FONT cmr10>
CL-USER>
I
Design goals: robustness & exibility
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 3/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
Robustness
Anticipate all potential problems to avoid crashes or erratic behavior.
I
20 potential problems identied, various degrees of severity
I
Examples
I
📕
Truncated le / invalid section pointers hopeless
I
📙
Cycle in a ligature program some hope
I
📗
Comment string inconsistency benign
I
Context-dependent severity
I
E.g. (overridden) design size
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 4/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
Flexibility
When possible, provide recovery options instead of just giving up.
I
Currently a dozen
I
Examples
I
Discarding a bogus kerning / ligature program
I
Fixing <table>[0] entries (widths, heights, depths, italic corrections)
I
I
Note: recovery is black magic (we can’t be sure to x the real problem)
I
Still, handy in interactive use
I
The whole point of tfm: no decision, only options
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 5/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
Interactive Use vs. Production
Example
CL-USER> (tfm:load-font "/tmp/cmr10.tfm")
While reading /tmp/cmr10.tfm,
while reading the character encoding scheme string,
padded string "TeX (ex)" is not in BCPL format.
See §10 of the TFtoPL documentation for more information.
[Condition of type NET.DIDIERVERNA.TFM:INVALID-PADDED-STRING]
Restarts:
0: [KEEP-STRING] Keep it anyway.
1: [FIX-STRING] Fix it using /'s and ?'s.
2: [DISCARD-STRING] Discard it.
3: [CANCEL-LOADING] Cancel loading this font.
--more--
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 6/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
tfm’s Error Ontology
For the fun of it…
file-overflow
cancel-loading
padded-string-overflow
invalid-original-design-size
character-list-cycle
discard-next-character
file-underflow
u16-overflow
fix-word-overflow
set-to-zero
invalid-padded-string keep-string
spurious-char-info
invalid-character-code
discard-extension-recipe
discard-kerning
discard-ligature
invalid-character-range
invalid-design-size set-to-ten
invalid-header-length
invalid-ligature-opcode
invalid-section-lengths
invalid-padded-string-length read-maximum-length
invalid-table-index
abort-lig/kern-program
invalid-table-length
invalid-table-start
ligature-cycle
no-boundary-character
fix-string discard-string
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 8/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
The tfm-validate Library
I
Motivation
I
Curiosity rather than necessity
I
Easy to do
I
Key ingredient: the Common Lisp “condition system”
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 9/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
Exception Handling
func1()
try/catch 1
func2()
try/catch 2
func3()
func4()
throw
func1()
handler 1
func2()
handler 2
restart 1
func3()
restart 2
func4()
signal
I
Classic try/catch/throw
I
2D SoC: handlers catch & resume
I
Common Lisp condition system
I
3D SoC: signal / handle / restart
I
OO exception management
I
Hierarchy of conditions classes
I
First-class conditions (instances)
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 10/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
Application: tfm-validate
(invalidate-font)
tfm handler
(load-font)
cancel loading
(other-func)
other restart
(other-func)
other restart
signal
tfm
tfm-validate
I
Just a (big) handler around tfm:load-font
I
Entry point: invalidate-font
I
Catch all tfm conditions
I
Select the “softest” restart
I
Collect the conditons before restarting
I
Return them at the end
I
Convenience 1: invalidate-directory
I
Surprisingly high number of issues
I
Convenience 2: invalidate-texlive
I
Issues in human-readable form (website)
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 11/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
T
E
X Live Validation
I
Current state
I
79016 fonts inspected
I
2983 fonts skipped (OFM & JFM)
I
770 fonts with non compliance issues
I
But…
I
Only 4 dierent issues found
I
3 warnings, 1 error
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 12/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
Warning: File Overow
I
Actual size > declared size
I
628 fonts aected
I
Only a warning
I
The fonts seem functional
I
tftopl ignores the junk
I
The junk doesn’t seem meaningful
Padding?
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 13/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
Warning: Padded String Overow
I
BCPL string tail 6= 0
I
74 fonts aected
I
Only a warning
I
pltotf 1.3
I
Strings purely informational
I
The junk can be meaningful
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 14/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
Warning: Spurious Char Info
I
Absent character 6= 0
I
66 fonts aected
I
Only a warning
I
pltotf zeroes out those chars
I
tftopl ignores them
I
Obscure matter
Apparently not related to boundary chars
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 15/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
Error: Fix Word Overow
I
Numerical value outside ]-16,+16[
I
2 fonts aected
I
Error
I
Character metrics messed up
I
T
E
X refuses those fonts
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 16/17
Copyright © 2024 Didier Verna, CC BY SA 4.0
Introduction
tfm tfm-validate
T
E
X Live
Conclusion
(Real) Conclusion
I
Wrap Up
I
Motivation: curiosity rather than necessity
Incentive to x (?), monitor new additions
I
One merit: the shape of TFM compliance today
Many non-compliant fonts, but only 2 really unusable
I
Perspectives
I
Support OFM & JFM
I
Support other formats (Open Type)
I
Improve layout (indexes, cross-references, etc.)
I
Add a write-font function to tfm
T
E
X Font Metrics Validation: Application to T
E
X Live / TUG 2024 17/17
Copyright © 2024 Didier Verna, CC BY SA 4.0