korlibs / korlibs/korlibs-image

using Bitmap.drawText() with characters containing tails, results in them being aligned to the bottom instead of the top

Open
#18 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Kotlin
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

I tried creating some text on a bitmap using korim: "test Ą/Ę"

but the resulting bitmap end up looking like this ↓

![image](https://github.com/korlibs/korlibs4/assets/68105407/377119b9-1dfe-4410-be05-db5240885ab9)

Characters on the following screenshot are aligned to the bottom instead of the center, and that makes characters like: Ą or Ę look odd.

i used the following snipped to render the text on the bitmap:

```kotlin
generatedFrame.drawText(
str = "test Ą/Ę",
font = resourcesVfs["font.ttf"].readTtfFont().toLazyBitmapFont(300F),
size = 90F,
pos = Vector2(
x = (generatedFrame.width / 2.0) - (textMetricsData.metrics.width / 2.0),
y = (generatedFrame.height / 2.0) - (textMetricsData.metrics.height / 2.0)
),
alignment = TextAlignment.TOP_JUSTIFIED
)
```

also, the font I used is [Bebas Neue](https://fonts.google.com/specimen/Bebas+Neue?query=bebas)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Kotlin snippet with Bitmap.drawText(), the string "test Ą/Ę", and the Bebas Neue font. Inspect the text metrics and TOP_JUSTIFIED alignment path used during bitmap rendering. Done means characters with tails, including Ą and Ę, are positioned consistently with the requested centered placement.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.