-
Notifications
You must be signed in to change notification settings - Fork 204
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
Crash when WriteUsedFontsDefinitions #237
Comments
Here is the way to reproduce it: build it and launch it and manually import the Noto CJK SC ttc (have to download the ttc first) And then open the doc (https://github.com/XmacsLabs/mogan/blob/v1.2.2/TeXmacs/doc/about/mogan/research.zh.tm), and change the font to Noto Serif CJK SC, and then export it to PDF. Here is the font I'm using: |
A simplified way to reproduce it is:
You should save the following snippets into
The only related font file is And the crash depends on the content of the document. |
Another truth is that when using Songti SC, it works fine. |
#150 might be the related issue. |
Well, finally, I found that it will crash on the character https://old.unicode-table.com/cn/9ED8/ here is the document to reproduce the bug:
|
Tried SourceHanSerifSC-Regular.otf in https://github.com/adobe-fonts/source-han-serif , it crashes too. |
This operators seq (without operand) occurs in
https://learn.microsoft.com/en-us/typography/opentype/spec/cff2charstr#one-byte-cff2-operators The logic to increase the
|
@darcy-shen where did you get the op code dump from? |
I skipped the callsubr here when there are no oprands.
|
gotcha. does this help in displaying the glyph properly? |
The PDF is ok but the glyph is missing. The exported pdf in the master branch is corrupted. |
Here is my debugging pr: #239 |
cool. I got something similar with CharStringType2Tracer. [on a mac just go might not make it to resolve this today, but tomorrow i got all day so i'll fairly confident i'll be able to come up with a correction. i'll compare and see where the problem is....there's definitely something, here's what they got:
|
yeah defo a bug there right at the start when reading how many stems there should be. this results in the hummus interpreter figuring there's 6 stems, while there are at least 17 which results in reading too few bytes later. |
ok. figured it out. and the glyph shows correctly. MR. i have a bug (for 13 year oh my) in the implementation of cntrmask operator. as opposed to a correct implementation of hintmask it was NOT CONSIDERING it might be used in a special way that optimizes not having to call vstem. as a result all later hintmasks and cntrmasks calls did not read enough of the following bytes (1 instead of 3) and this resulted in a wonderful mass with creating random operands. anyways, fixed the code of cntrmask and it seems ok now. please let me know if this resolves the problem on your end too. |
It fixed my bug, thanks a lot. It will benefit all Mogan/GNU TeXmacs users on Linux who are using CJK characters. |
I changed one of the font from Songti.ttc to NotoSerifCJK-Regular.ttc, and it crashes.
I guess there are some thing wrong here:
https://github.com/XmacsLabs/mogan/blob/v1.2.2/src/Plugins/Pdf/pdf_hummus_renderer.cpp#L1207-L1245
I checked
pdfWriter.GetFontForFile
, for the same font file, it always return the same pointer.The text was updated successfully, but these errors were encountered: