-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: Dynamic Runtime Rasterized MSDF Sprite Font #3055
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
Open
yuechen-li-dev
wants to merge
39
commits into
stride3d:master
Choose a base branch
from
yuechen-li-dev:runtime-msdf-font
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
d49b9ff
M1: Added Runtime SDF placeholder.
yuechen-li-dev 3275c16
M2. MSDF Cache Scaffold.
yuechen-li-dev 5d9185f
M3: Font works end to end, renders ugly circles.
yuechen-li-dev 75f5369
M4 WIP: Buggy implementation with flickers so far.
yuechen-li-dev 1fa1cd4
It works, but each text spins computer like jet engine.
yuechen-li-dev 2f0b165
Async implementation and various optimizations.
yuechen-li-dev dd4f8e0
Fixed bad copypaste for SpriteFontAssetCompiler.cs
yuechen-li-dev 0dc668c
Less sloppy Async.
yuechen-li-dev 69e2f15
Revert "Less sloppy Async."
yuechen-li-dev 7ad4caa
Remove runtime SDF bake size plumbing
yuechen-li-dev b04c959
Merge pull request #4 from yuechen-li-dev/codex/refactor-glyph-sizing…
yuechen-li-dev d5d9576
Adjusted default bakesize to 64 so SDF is high quality.
yuechen-li-dev 18e227d
Merge branch 'stride3d:master' into Runtime-SDF-Font
yuechen-li-dev 217a8fd
Changed to channel based async design.
yuechen-li-dev e2e9f09
Channel based refactor for async, introduce interface for easier libr…
yuechen-li-dev ae2e234
See above message. Wrong commit lol.
yuechen-li-dev a0058c4
Merge branch 'Runtime-SDF-Font' of https://github.com/yuechen-li-dev/…
yuechen-li-dev 914819d
refactor for future MSDFGeneration.
yuechen-li-dev 048b521
Initial wiring. Need to fix generationPipeline.
yuechen-li-dev d7d8d5b
Ok, it renders but only as blocks or dots. Debug time.
yuechen-li-dev dbba408
It works! Mostly. Need to squash some font specific bugs.
yuechen-li-dev a22eb17
Next try with MsdfGen too.
yuechen-li-dev e455a49
Comment edits.
yuechen-li-dev cc65561
clean up gitignore of temp file.
yuechen-li-dev 4d9159c
Move offset logic out of ApplyUploadedGlyph for safety. Change glyphk…
yuechen-li-dev dd6b53a
Minor changes so VS would have less messages.
yuechen-li-dev 738280e
Cleaned up nullable in FontSystem.
yuechen-li-dev 92e5460
removed unsafe keyword and unneed cast for buffer copy.
yuechen-li-dev 739c69e
Spacing consistancy in pregenerated glyph method.
yuechen-li-dev 0bea15f
Changed the font manager to private.
yuechen-li-dev 6a98305
Remove extra colon.
yuechen-li-dev a457fd6
Remerged MSDF method into FontManager. Remerged unused overload. Gene…
yuechen-li-dev 3463072
Changed warning from scaffolding to indicate experimental feature. Si…
yuechen-li-dev 113d16d
Moved comment to more accurately depict pipeline for upload step.
yuechen-li-dev f2930a2
Small refactor for EnsureSdfScheduled to address 0 dimension glyphs a…
yuechen-li-dev 3176a76
Removed debug message from FontCacheManagerMSDF and cleanup for reada…
yuechen-li-dev dcfae4b
Move oversized glyph dimension check from FontCacheManager to Font fi…
yuechen-li-dev f8aadd1
Re-added accidentally deleted packer logic.
yuechen-li-dev 0753019
remove unused bool isClosed definition from outline extractor.
yuechen-li-dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
sources/engine/Stride.Assets/SpriteFont/RuntimeSignedDistanceFieldSpriteFontType.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) | ||
| // Distributed under the MIT license. See the LICENSE.md file in the project root for more information. | ||
|
|
||
| using System.ComponentModel; | ||
| using Stride.Core; | ||
| using Stride.Core.Annotations; | ||
| using Stride.Core.Mathematics; | ||
|
|
||
| namespace Stride.Assets.SpriteFont | ||
| { | ||
| [DataContract("RuntimeSignedDistanceFieldSpriteFontType")] | ||
| [Display("Runtime SDF")] | ||
| public class RuntimeSignedDistanceFieldSpriteFontType : SpriteFontTypeBase | ||
| { | ||
| /// <inheritdoc/> | ||
| [DataMember(30)] | ||
| [DataMemberRange(MathUtil.ZeroTolerance, 2)] | ||
| [DefaultValue(20)] | ||
| [Display("Default Size")] | ||
| public override float Size { get; set; } = 64; | ||
|
|
||
| /// <summary> | ||
| /// Distance field range/spread (in pixels) used during MSDF generation. | ||
| /// </summary> | ||
| [DataMember(40)] | ||
| [DefaultValue(8)] | ||
| [DataMemberRange(1, 64, 1, 4, 0)] | ||
| [Display("Pixel Range")] | ||
| public int PixelRange { get; set; } = 8; | ||
|
|
||
| /// <summary> | ||
| /// Extra padding around each glyph inside the atlas (in pixels). | ||
| /// </summary> | ||
| [DataMember(50)] | ||
| [DefaultValue(2)] | ||
| [DataMemberRange(0, 16, 1, 2, 0)] | ||
| [Display("Padding")] | ||
| public int Padding { get; set; } = 2; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why kerning is always off, on this call site and all other usage I could find
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial basis of this project is an exact copy of the runtime rasterized font that was already in the system.
https://github.com/stride3d/stride/blob/master/sources/engine/Stride.Assets/SpriteFont/SpriteFontAssetCompiler.cs
And kerning was set as off for it, so I just copied.