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

otf2bdf alternate/bugfix y offset calculation (-y) (was: u8g2_font_tool) #2406

Open
Dozingfiretruck opened this issue Mar 18, 2024 · 18 comments
Labels
Milestone

Comments

@Dozingfiretruck
Copy link
Contributor

Hi,I've written a font survival tool that supports graphics and command lines, can I add it to the intro and tools/font?

https://github.com/Dozingfiretruck/u8g2_font_tool

@olikraus
Copy link
Owner

sounds cool. Is there any example to demonstrate the advantage of your tool compared to the existing u8g2 toolset?

@Dozingfiretruck
Copy link
Contributor Author

sounds cool. Is there any example to demonstrate the advantage of your tool compared to the existing u8g2 toolset?

1,Solve the problem that the OTF2BDF tool does not handle some fonts well, resulting in the misalignment of individual characters,such as oppo 、xiaomi font 。 zuff font , ' will display , (Very many characters)and so on .but OTF2BDF not maintenance。
2,It is very easy to ues,ttf->c
3,It has shell version and ui version

Our company is already using the new tool, and the problem of Chinese font deviation displayed by the previous tool is still relatively serious

@Dozingfiretruck
Copy link
Contributor Author

Dozingfiretruck commented Apr 2, 2024

zfull font
old tools:
image
new tools:
image
_ ` * , . ' ” ,。and so on can be handled correctly

@Dozingfiretruck
Copy link
Contributor Author

Is there anything else need me to provide?

@olikraus
Copy link
Owner

So your tool is a replacement for OTF2BDF and will create a .bdf file, correct?
I am not sure what exactly I shell do here. If I remember correctly, then u8g2 will use .bdf files only for Chinese fonts.

@Dozingfiretruck
Copy link
Contributor Author

So your tool is a replacement for OTF2BDF and will create a .bdf file, correct? I am not sure what exactly I shell do here. If I remember correctly, then u8g2 will use .bdf files only for Chinese fonts.

It is the equivalent of a U8G2 dedicated font processing software, where the OTF2BDF implementation is partially rewritten to fix the above bugs introduced by OTF2BDF

@olikraus
Copy link
Owner

The effort of replacing the current u8g2 font generation chain is very high and I still don't see the benefit. I have never seen any font in u8g2 where the comma is located at the wrong place. Is there any existing font in u8g2 where this is the case?

@Dozingfiretruck
Copy link
Contributor Author

Maybe you rarely test Chinese? Or Chinese doesn't use many fonts? There have been a lot of abnormalities in the TTF of non-monospaced fonts and single pixels, in fact, not only Chinese, the impact of symbols is universal, the root of the problem lies in the OTF2BDF, this problem we have also troubled for a long time to solve, so I hope to add this tool to the document to help others, not to replace the original font tool, but to have one more option to solve the existing problem, probably most non-Chinese users or users who are not sensitive to font copyright will not encounter this problem

@Dozingfiretruck
Copy link
Contributor Author

Maybe you rarely test Chinese? Or Chinese doesn't use many fonts? There have been a lot of abnormalities in the TTF of non-monospaced fonts and single pixels, in fact, not only Chinese, the impact of symbols is universal, the root of the problem lies in the OTF2BDF, this problem we have also troubled for a long time to solve, so I hope to add this tool to the document to help others, not to replace the original font tool, but to have one more option to solve the existing problem, probably most non-Chinese users or users who are not sensitive to font copyright will not encounter this problem

In addition, I can provide a more obvious ttf font that can reproduce the problem, and you should feel this problem more obviously when you test it yourself

@olikraus
Copy link
Owner

Yes, such a font would be nice

@Dozingfiretruck
Copy link
Contributor Author

Yes, such a font would be nice

zfull-regular.zip

olikraus added a commit that referenced this issue May 27, 2024
@olikraus
Copy link
Owner

hmm, thanks for the font. I now see the issue. I am still not sure, whether this is a font issue, but indeed it looks like a otf2bdf problem. I fixed this by adding an extra switch in cases to otf2bdf.

y_off = sy + face->glyph->bitmap_top - face->glyph->bitmap.rows;
// u8g2 issue 2406
// the above calculation seems to be wrong, this should be:
if ( alternate_y_offset_calculation )
y_off = face->glyph->bitmap_top - ey;

Not sure whether the fix is correct, but it will fix the problem with your font.

@olikraus olikraus added this to the 2.35 milestone May 27, 2024
@olikraus olikraus changed the title u8g2_font_tool otf2bdf alternate/bugfix y offset calculation (-y) (was: u8g2_font_tool) May 27, 2024
@Dozingfiretruck
Copy link
Contributor Author

sounds cool. Is there any example to demonstrate the advantage of your tool compared to the existing u8g2 toolset?

1,Solve the problem that the OTF2BDF tool does not handle some fonts well, resulting in the misalignment of individual characters,such as oppo 、xiaomi font 。 zuff font , ' will display , (Very many characters)and so on .but OTF2BDF not maintenance。 2,It is very easy to ues,ttf->c 3,It has shell version and ui version

Our company is already using the new tool, and the problem of Chinese font deviation displayed by the previous tool is still relatively serious

it is bug of otf2bdf,but OTF2BDF not maintenance , so i make this tool ,In most cases, Linux users will apt and install without compiling the OTF2BDF, and may not be aware of the problem

@agugu2000
Copy link

sounds cool. Is there any example to demonstrate the advantage of your tool compared to the existing u8g2 toolset?

1,Solve the problem that the OTF2BDF tool does not handle some fonts well, resulting in the misalignment of individual characters,such as oppo 、xiaomi font 。 zuff font , ' will display , (Very many characters)and so on .but OTF2BDF not maintenance。 2,It is very easy to ues,ttf->c 3,It has shell version and ui version
Our company is already using the new tool, and the problem of Chinese font deviation displayed by the previous tool is still relatively serious

it is bug of otf2bdf,but OTF2BDF not maintenance , so i make this tool ,In most cases, Linux users will apt and install without compiling the OTF2BDF, and may not be aware of the problem

How is your tools calculating the box parameter?I've tested it will generate a very small box that matches most of characters.But for safety considerations, the original code enlarged the box by using the difference between the left and right boundaries. This can make the font appear exceptionally small in certain decoding environments (which is unrelated to your project).

@olikraus
Copy link
Owner

olikraus commented Jun 1, 2024

How is your tools calculating the box parameter?

I have patched otf2bdf:
jirutka/otf2bdf@56a38ff

@olikraus
Copy link
Owner

olikraus commented Jun 1, 2024

The bug fix to my local copy of otf2bdf is here:
17b0cca

@agugu2000
Copy link

The bug fix to my local copy of otf2bdf is here: 17b0cca

Sorry i didn't see this before.is it a new toos based on the original otf2bdf?i Will have a try.

@olikraus
Copy link
Owner

olikraus commented Jun 2, 2024

I just added the fix view days ago based on this issue here

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

No branches or pull requests

3 participants