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

Able to create skin font by list of chars. #787

Open
andy840119 opened this issue Jul 27, 2021 · 6 comments
Open

Able to create skin font by list of chars. #787

andy840119 opened this issue Jul 27, 2021 · 6 comments
Labels
skin About skin resource

Comments

@andy840119
Copy link
Member

Even if #527 is not implemented, it's still able to do this issue.

The issue will be separated into two parts:

  • think about how to collect all the font usage and text in lyrics and notes. e.g: might create something like dictionary<fontUsage, chars[]>
  • should have a way to export the .fnt file and its image files.
@andy840119 andy840119 added the skin About skin resource label Jul 27, 2021
@andy840119
Copy link
Member Author

andy840119 commented Jul 27, 2021

got the fuckng idea:

  • move font into skin/font.
  • let FontManager inherit ArchiveModelManager<FontInfo, FontFileInfo>

update:

  • maybe should cancel the second one because not really sure stores the font into the database or real path (consider that the user might lot of fonts?)...

@andy840119
Copy link
Member Author

andy840119 commented Jul 27, 2021

And the FontManager is aimmed:

  • import and save the fonts (with .fnt format now, might able to support .otf ).
  • Get GlyphStore by font manager. (remove exist GameHostExtension)
  • Export font?
  • Export font with target charset -> not really sure what the format is

@andy840119
Copy link
Member Author

andy840119 commented Jul 27, 2021

And should have processer:

  • to convert CharacterGlyph (or TextureUpload) back to characters.
  • should be able to generate .fnt text file.
  • should be able to generate images by list of characters.

have no idea about the architecture.

@andy840119
Copy link
Member Author

andy840119 commented Jul 28, 2021

And see this article to understanding some magic property like:

  • xoffset = how many pixels to shift the character right (= extra blank pixels to left of character)
  • yoffset = how many pixels to shift the character down (= extra blank pixels above character)
  • xadvance = total width of character in pixels (so adds xadvance-xoffset-width extra blank pixels to the right of character)

guess still need to got a demo picture 😢

[update]

Have a picture now, not really sure it's correct but better than none.
image

@andy840119
Copy link
Member Author

And about how to placing most characters into single image (1024*1024)
should googling font pack algorithm C#

here are some useful links:

@andy840119
Copy link
Member Author

andy840119 commented Jul 30, 2021

https://ttf2fnt.com/
just a meno:
this is the website to convert .ttf into .fnt

ppy/osu-framework#5994
And maybe can use thie algoritm to reduce the image size?
Also, not very sure should create another package for packing the image to .fnt format?

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

No branches or pull requests

1 participant