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

feat: Added SpriteFont class #1992

Merged
merged 18 commits into from
Oct 7, 2022
Merged

feat: Added SpriteFont class #1992

merged 18 commits into from
Oct 7, 2022

Conversation

st-pasha
Copy link
Contributor

@st-pasha st-pasha commented Oct 2, 2022

Description

This PR adds the SpriteFont class, which encapsulates reusable information about a sprite font. Text renderers / text formatters can be created based on this SpriteFont.

In addition:

  • GlyphInfo removed (was internal), and GlyphData deprecated -- instead, there is now a consolidated Glyph class;
  • Sprite font now supports extended Unicode characters and ligatures (when a combination of letters is represented as a single glyph)
    • This feature can also be used to define simple name substitutions. For example, you can declare that "[gp]" or "&gp;" would represent a gold coin icon;
  • Sprite font supports variable-width fonts;
  • Sprite font supports glyphs where the source rect is different from the logical rect;
  • Sprite font renderer can now control the color of the text rendered.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • [-] Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #1935

Copy link
Member

@spydon spydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! Some minor comments

@spydon spydon requested a review from a team October 2, 2022 18:39
@spydon spydon enabled auto-merge (squash) October 7, 2022 14:54
@spydon spydon merged commit a0d7ead into main Oct 7, 2022
@spydon spydon deleted the ps.sprite-font branch October 7, 2022 14:59
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create SpriteFont class
3 participants