Skip to content

Commit

Permalink
Position is better vertically, as long as...
Browse files Browse the repository at this point in the history
... we don't rotate. And for now, I'm OK with that.
  • Loading branch information
tommyettinger committed Jan 20, 2025
1 parent 7e081d8 commit 03a37c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/main/java/com/github/tommyettinger/textra/Font.java
Original file line number Diff line number Diff line change
Expand Up @@ -5192,8 +5192,7 @@ public float drawGlyph(Batch batch, long glyph, float x, float y, float rotation
float xc = (tr.offsetX * scaleX * sizingX) - cos * centerX - font.cellWidth * 0.5f;

float trrh = tr.getRegionHeight();
float yt = (font.originalCellHeight - (trrh + tr.offsetY)) * scaleY * sizingY + sin * centerX
- centerY;
float yt = (font.originalCellHeight - (trrh + tr.offsetY)) * scaleY * sizingY + sin * centerX - centerY;
if(squashed) yt -= font.descent * scaleY * sizingY * 0.175f;

float h = trrh * scaleY * sizingY;
Expand Down Expand Up @@ -5229,14 +5228,14 @@ public float drawGlyph(Batch batch, long glyph, float x, float y, float rotation
xc -= xch + stretchShift;
x += xch + stretchShift;

// float ych = tr.offsetY * scaleY * sizingY;
yt = (sin * scaledHeight - scaledHeight - stretchShift) * 0.5f;
float ych = tr.offsetY * scaleY * sizingY;
yt = (sin * scaledHeight - scaledHeight) * 0.5f - ych - stretchShift;


// yt = - ych - stretchShift - font.descent * fsy * scale * sizingY + sin * centerX - centerY;
if(squashed) yt -= font.descent * scaleY * sizingY * 0.175f;
// yt -= ych + stretchShift;
y = oy + (scaledHeight) * 0.5f - stretchShift;
y = oy + (scaledHeight) * 0.5f - stretchShift - ych;

// y += ych - stretchShift + font.descent * fsy * scale * sizingY;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public void create() {
stage = new Stage();
screenStage = new Stage();
// Font gentium = KnownFonts.addEmoji(KnownFonts.getGentiumUnItalic(Font.DistanceFieldType.MSDF));
Font mainFont = KnownFonts.addEmoji(KnownFonts.getComicMono(Font.DistanceFieldType.SDF));
Font mainFont = KnownFonts.addEmoji(KnownFonts.getComicMono(Font.DistanceFieldType.SDF)).setInlineImageStretch(0.5f);
// Font mainFont = KnownFonts.addEmoji(KnownFonts.getIosevka(Font.DistanceFieldType.MSDF));
Font supportFont = KnownFonts.addEmoji(KnownFonts.getComputerSaysNo(Font.DistanceFieldType.SDF));
Font supportFont = KnownFonts.addEmoji(KnownFonts.getComputerSaysNo(Font.DistanceFieldType.SDF)).setInlineImageStretch(0.5f);

// varWidthFont = KnownFonts.getGentium();
varWidthFont = KnownFonts.getComicMono(Font.DistanceFieldType.SDF_OUTLINE)
Expand Down

0 comments on commit 03a37c1

Please sign in to comment.