aiekick / ImGuiFontStudio

Embedded Font Helper Gui Tool for programming
Apache License 2.0
384 stars 33 forks source link

Merged fonts not working #7

Open selimanac opened 4 years ago

selimanac commented 4 years ago

I did merge two different font files. Fonts from second file(tasks.ttf) is not working from generated as header+cpp. Files are attached below.

Screen Shot 2020-05-11 at 22 08 12

Header + CPP files: Archive.zip

 ImGui::MenuItem(ICON_FileMenu_ROOT); // Not showing
 ImGui::MenuItem(ICON_FileMenu_OPEN);

Screen Shot 2020-05-11 at 22 10 58

aiekick commented 4 years ago

Hello,

ok thanks, i will test.

can you give your font file for a test case ? if you cant, can you open the merged font file in the soft and show the result. if you not see the glyph, display the glyph panel and select it in the current font pane, for see the result. maybe its merged but maybe theses glyph are very very small. i had the case with my tests.

what are the resolution of the two fonts you use ? maybe one is very small compared to other ?

the best case is to have two font with exactly same ascent/descent and baseline for the moment.

for the moment the quick thing you can do is to use the old way :

selimanac commented 4 years ago

can you give your font file for a test case ?

Fonts and .ifs file is attached below. fontstudio.zip

what are the resolution of the two fonts you use ? maybe one is very small compared to other ?

They should be same because I draw some of them . If they are not then I made a mistake when drawing.

the best case is to have two font with exactly same ascent/descent and baseline for the moment.

Sorry, I have no idea about that. I use icomoon.io to prepare icons/fonts

merge manually the glyphs you want from one font file to another font file via by ex fontforge. (like that you can adjust glyph size, pos and others things use this merged file for generate in ImGuiFOntStudio the cpp/headers files.

I will, thank you.

aiekick commented 4 years ago

i have maybe another explain.

there is two type of font glyphs. the simple glyph and the compound glyph. Compund glyph is composed of many other glyph available in font.

ImGuiFontStudio can export for the moment only simple Glyph. so if your glyph is a compund he is empty in the merged font

Edit : i have tested and indeed its a bug. many glyphs seems not exported. and they are all simple glyphs. i will check that tonight :)

aiekick commented 4 years ago

the glyph re write can produce some time a bad format of font file. i not seen that with my fonts, but he is with your font.

i found its due to maybe one glyph who produce bad rewrite and a corrupted file with other or less selection some time it work some time not. will be difficult to found why, but its interesting.

by the way for the moment i have added a option for disable the glyph rescale, if the user want. Glyph rescale is needed if font ascent/descent are different. in your case its same. but the glyph resize in fact is according the bounding box of each glyph.

btw with this option (in generator pane in settings), each glyphs are just moved from one font to the merged font result. no rewrite, no corruption, but no rescale/translation, so some glyph can be badly positionned regarding other.

if you need to adjust some glyphs, you can modify if with fontforge (edit the glyph you want), and finish the job in ImGuiFontStudio :)

see : WWrnxciblJ To note : The quick button i use is only available in debug mode, no impact on the normal way. The result will be same

aiekick commented 4 years ago

had some issue on last fix for macos/linux. but its fixed now. so you can pull

selimanac commented 4 years ago

Sorry for late response. This works great, thank you :)

aiekick commented 4 years ago

it seems your two fonts have issue. in fontforge when you go in menu : element / validation (for french menu)

he found many errors on many glyphs ,and seem to be the glyphs we not see after merge. like the Root glyph

So the question is : how can we avoid issue with bad glyph format :)

selimanac commented 4 years ago

how can we avoid issue we bad glyph format :)

Yeah, it is my bad :) Sorry about that. I don't know much about glyph. I have Fontforge installed but looks too complex to me. So I did use the icomoon.io for generating fonts from my svg files. I draw those svg's at Illustrator by using Material Icons guideline. But it is highly possible that I did some mistakes when drawing. Also it is possible that icomoon.io is failling at some point and cause this problem.

I will definitely check out the Fontforge properly.

Thank you.

aiekick commented 4 years ago

np, its interesting, all the softwares can avoid the issue and generate good font. so i need to do same. just to found the exact issue in my generation and found a solution :)

and its in my plan to have the possibilite to draw glyph and merge svg, so at a moment i need to be robust for this generation :) thanks np :)

aiekick commented 4 years ago

i found, the cmap table who is responsible of glyph mapping, is badly generated. so maybe on some font like yours cause some border effect on some glyphs. i seen crash of stb_truetype with my generated font..

selimanac commented 4 years ago

it seems your two fonts have issue. in fontforge when you go in menu : element / validation (for french menu)

he found many errors on many glyphs ,and seem to be the glyphs we not see after merge. like the Root glyph

This was really helpful, thank you. I clean all errors by using Fontforge.

aiekick commented 4 years ago

so, after glyph correction in font forge, the merge in ImGuiFontStudio was ok ? this is that ?

selimanac commented 4 years ago

so, after glyph correction in font forge, the merge in ImGuiFontStudio was ok ? this is that ?

Yes it is. It is ok in ImGuiFontStudio. Problems was about my faults(drawing directions and wrong compound paths may cause fail).

aiekick commented 4 years ago

ok good to hear. i will try to detect and correct bad path so. thanks