kostub / iosMath

Beautiful math equation rendering on iOS and MacOS
MIT License
1.36k stars 234 forks source link

Error using fonts #102

Open adilsal33m opened 6 years ago

adilsal33m commented 6 years ago

I am not able to use any other font apart from the three fonts supplied with the library. I have added the font correctly along with the plist. Are we suppose to put the font in a specific bundle because the error is due to not being able to locate font in the bundle in MTFont's initFontWithName method.

Any help will be appreciated. Thanks.

kekearif commented 5 years ago

@adilsal33m Hey, I'm tying to add a font myself. How did you generate the plist? I keep getting errors.

I tried to generate the plist first with the included font file (just for testing purposes) latinmodern-math.otf. I did the following steps:

However when I run the script I get the following error:

Traceback (most recent call last):
  File "math_table_to_plist.py", line 203, in <module>
    main()
  File "math_table_to_plist.py", line 200, in main
    process_font(font_file, plist_file)
  File "math_table_to_plist.py", line 11, in process_font
    font = TTFont(font_file)
  File "/Users/kekearif/Desktop/font/lib/python2.7/site-packages/fontTools/ttLib/ttFont.py", line 140, in __init__
    self.reader = SFNTReader(file, checkChecksums, fontNumber=fontNumber)
  File "/Users/kekearif/Desktop/font/lib/python2.7/site-packages/fontTools/ttLib/sfnt.py", line 81, in __init__
    raise TTLibError("Not a TrueType or OpenType font (bad sfntVersion)")
fontTools.ttLib.TTLibError: Not a TrueType or OpenType font (bad sfntVersion)

Any idea what I am doing wrong where and why I am getting this error?

cupojoe commented 5 years ago

@adilsal33m I got a custom font to work, but not how the readme says. I had to go into the font manager and add it there as the default. Also in the Typesetter they are hardcode referencing latin modern. Had to change it there to use the default instead.