Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support embed glyphs for font #4

Open
starburst997 opened this issue Nov 21, 2018 · 2 comments
Open

Support embed glyphs for font #4

starburst997 opened this issue Nov 21, 2018 · 2 comments

Comments

@starburst997
Copy link
Owner

An interesting feature would be to also save the embedded font from the SWF (optionally). This way this could solve the issue with user generated chinese text (which would not be practicable using Bitmap Font).

See: https://github.com/openfl/openfl/blob/f6dd84709ec233bb4e78cec7e9d6c9f39d4bad95/src/openfl/_internal/symbols/StaticTextSymbol.hx#L99

We would then be able to draw the glyph pretty much using simple "lineTo" etc.

I have a few ideas on how to do it, we could render the whole text as a Bitmap, we could have reserved space in the texture and render the text there or we could draw the glyph as needed into the texture, if we hit a limit we overwrite the oldest accessed one.

Nothing is perfect but that might just do the trick, as long as it is fast (I guess we'll see once this is build).

For heaps we would need to add support for "curveTo", we can probably approx. cubicCurveTo like Granick did here: https://github.com/openfl/lime/blob/2af3edb88e3c05b70faab3279292a45ba2c4860b/src/lime/tools/FlashHelper.hx#L376

Another completely separated solution would be to use FreeType and we render the text (or glyph) into the texture, but I kind of like the "haxe-only" approach, makes things even more portable, if we have performance issue, then FreeType it is!

FreeType mirror: https://github.com/aseprite/freetype2

@starburst997
Copy link
Owner Author

curveTo could be approx. using lineTo (I think!) for extra performance we could even hard-code the "lineTo" into the file itself (optionally) saving some computation time by having extra bits to the filesize.

@starburst997
Copy link
Owner Author

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

No branches or pull requests

1 participant