Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to generate metric xml file from ttf file #98

Open
mhao1999 opened this issue May 25, 2022 · 6 comments
Open

How to generate metric xml file from ttf file #98

mhao1999 opened this issue May 25, 2022 · 6 comments

Comments

@mhao1999
Copy link

mhao1999 commented May 25, 2022

I've read this issue, and issue below command to generate .pl file successfully, however, the result cannot be matched to the values from jlm_msbm10.xml, not only decimal place, but also the value itself, could you please kindly help me out? thanks.
PS C:\Program Files\MiKTeX\miktex\bin\x64> .\ttf2tfm.exe D:\tem\jlm_msbm10.ttf d:\tem\jlm_msbm10.tfm
PS C:\Program Files\MiKTeX\miktex\bin\x64> .\tftopl.exe D:\tem\jlm_msbm10.tfm D:\tem\jlm_msbm10.pl

the result are like:
(CHARACTER O 2
(CHARWD R 0.777)
(CHARHT R 0.646)
(CHARDP R 0.249)
)
(CHARACTER O 3
(CHARWD R 0.777)
(CHARHT R 0.836)
(CHARDP R 0.327)
)
(CHARACTER O 4
(CHARWD R 0.777)
(CHARHT R 0.836)
(CHARDP R 0.327)
)

but in the original file they are like (focus on values):

   <Char code="33" width="0.777781" height="0.635971" depth="0.135971" />
   <Char code="34" width="0.777781" height="0.757257" depth="0.251422" />
   <Char code="35" width="0.777781" height="0.757257" depth="0.251422" />
@calixteman
Copy link
Contributor

It shouldn't be that hard to write a python script in using ttx from fonttools to generate such data.

@mhao1999
Copy link
Author

thank you, calixteman, do you mean write a program to convert format? my question is: e.g. the code "33", height is "0.635971", I search through the generated .pl file, and cannot find any number close to "0.635xxx" (or "0.636xxx"). Or using ttx from fonttools can adjust the number itself? thanks!

@ForNeVeR
Copy link

Hey, thanks for your answer.

I am a maintainer of another JMathTeX successor project, WPF-Math. And I've asked the same question several years ago: #7.

Unfortunately, we've got no definitive answer so far. FYI, I don't think that TTF files include all the required information, so perhaps we'll have to work with the original TFM files provided as the font source, to gather all the details.

Also, some progress has been made by WPF-Math collaborators in comments to this issue: ForNeVeR/xaml-math#109.

@calixteman
Copy link
Contributor

You're right, the old font file are still using tfm for metrics.
About jlm_msbm10.xml, the metrics have likely been found in
http://mirrors.ctan.org/fonts/amsfonts/tfm/msbm10.tfm
Thx to tftopl, you should be able to get the metrics.

@murkle
Copy link
Collaborator

murkle commented Jun 1, 2022

@ForNeVeR You might be interested in https://github.com/opencollab/jlatexmath/tree/experimental - we've removed all the XML files (data moved to Enums etc) for smaller code / faster loading

Also the code is structured to allow easy porting to other platforms (see desktop / share / web) so it may be possible to port with eg https://www.tangiblesoftwaresolutions.com/product_details/java_to_csharp_converter.html

@ForNeVeR
Copy link

ForNeVeR commented Jun 1, 2022

@murkle, thanks, I've taken a look at the branch.

It doesn't still answer the question about how exactly the data was generated: it seems it was just moved from XML to Java files, and I wasn't able to find the script (or was there a script?) which may be used to extract the data from the .tfm files.

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

No branches or pull requests

4 participants