dmMaze / BallonsTranslator

深度学习辅助漫画翻译工具, 支持一键机翻和简单的图像/文本编辑 | Yet another computer-aided comic/manga translation tool powered by deeplearning
GNU General Public License v3.0
2.68k stars 179 forks source link

Font size bug? #541

Closed andy-julot closed 2 months ago

andy-julot commented 2 months ago

When I set typesetting to "Use global setting", the font size result is very strange. The generated json file for font size seems to be bigger than what I selected in font style. But the generated font size in the result image is much smaller. I'm really confused here.

dmMaze commented 2 months ago

The font size shown in GUI is point size, and it is stored as pixel size for cross-platform compatibility. Here's the convert function, note shared.LDPI is assigned to the right value (usually bigger than 72) once app is launched: https://github.com/dmMaze/BallonsTranslator/blob/cad1ff4cba035e31bb2bce237cf11fea74056f32/utils/fontformat.py#L6-L10

As for the smaller font size in the generated image, is the stroke width > 0?

andy-julot commented 2 months ago

The font size shown in GUI is point size, and it is stored as pixel size for cross-platform compatibility. Here's the convert function, note shared.LDPI is assigned to the right value (usually bigger than 72) once app is launched:

I see, so that's why they're different.

As for the smaller font size in the generated image, is the stroke width > 0?

Oh yes, I use 0.2 for stroke. But I think that's not a problem. Let me illustrate what I means.

Here is my setting:

Global Font Format

Typesetting

After I click Run this is the result:

Generated Result

Because the generated text is outside of the balloon boundary, I adjust it:

Adjusted Boundaries

Because I think I can still increase the font size I try to change the font size, that's when I realize something strange. After I change the size to other than 20 and back to 20 by choosing the font size combo box, the generated text seems bigger like this:

Manual Font Size

Wasn't it supposed to be the same size?

dmMaze commented 2 months ago

After I click Run this is the result:

Generated Result

Double click this text block, the font size displayed in the font menu should be less than 20. It is adjusted so that font size + stroke size = target size, it is meaningful for automatic mode (to match the source text size) but not for use global setting, it should be fixed by 66d191e

andy-julot commented 2 months ago

It fixed now, thank you.