-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from andy840119/fix-ruby-romaji-text-position…
…-calculation Fix the ruby/romaji position x position calculation in the `PositionTextBuilder`.
- Loading branch information
Showing
5 changed files
with
64 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,27 @@ | ||
// Copyright (c) karaoke.dev <contact@karaoke.dev>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Primitives; | ||
using osu.Framework.Text; | ||
|
||
namespace osu.Framework.Utils | ||
{ | ||
public class TextBuilderGlyphUtils | ||
{ | ||
public static RectangleF GetCharacterRectangle(TextBuilderGlyph character, bool drawSizeOnly) | ||
{ | ||
if (drawSizeOnly) | ||
return character.DrawRectangle; | ||
|
||
// todo: should get the real value. | ||
var topReduce = character.Baseline * 0.3f; | ||
var bottomIncrease = character.Baseline * 0.2f; | ||
return character.DrawRectangle.Inflate(new MarginPadding | ||
{ | ||
Top = character.YOffset - topReduce, | ||
Bottom = character.Baseline - character.Height - character.YOffset + bottomIncrease, | ||
}); | ||
} | ||
} | ||
} |