flowkey / UIKit-cross-platform

Cross-platform Swift implementation of UIKit, mostly for Android
MIT License
594 stars 40 forks source link

fix multiline text size calculcation #330

Closed michaelknoch closed 3 years ago

michaelknoch commented 3 years ago

Fixes https://app.asana.com/0/1190553484415965/1200141498205813

Type of change: bugfix

Motivation (current vs expected behavior)

There is a bug in the text rendering logic, where the frame of a UILabel does not match with the actual surface being rendered by SDL_TTF. This happens when the text renders very close to the right edge of the frame.

I revisited the code in TTF_RenderUTF8_Blended_Wrapped and found a minor difference there with what we have in the font renderer.

broken:

Screenshot 2021-04-06 at 18 55 47 Screenshot 2021-04-06 at 20 22 12

fixed

Screenshot 2021-04-06 at 20 31 02

Please check if the PR fulfills these requirements

codecov[bot] commented 3 years ago

Codecov Report

Merging #330 (7d2736a) into master (c995949) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #330   +/-   ##
=======================================
  Coverage   51.25%   51.25%           
=======================================
  Files          87       87           
  Lines        2899     2899           
=======================================
  Hits         1486     1486           
  Misses       1413     1413           
Impacted Files Coverage Δ
Sources/FontRenderer.swift 58.13% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c995949...7d2736a. Read the comment docs.