Skip to content
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

Improvements / fixes to textdraw.cpp #287

merged 5 commits into from Mar 31, 2019


Copy link

commented Mar 31, 2019

This should yield:

  • More accurate glyph spacing (fewer unexpected "gaps" between characters)
  • More accurate glyph shaping / sizing
  • Much more accurate text width calculations - especially noticeable in the case of a string with trailing spaces
  • More accurate cursor positioning in text fields (W_EDITBOX).
past-due added 5 commits Mar 29, 2019
TextDraw: Improve logical / layout text dimension calculations
The code did not differentiate between the dimensions needed for the rasterized text buffer, and the *layout* dimensions of the text.

WzText::width()/height() should return the _layout_ dimensions, as should getTextMetrics, iv_GetTextWidth/Height, etc.

The layout dimensions may be bigger than the rasterized text buffer dimensions - for example, in the case of a string with a space on the end.

(While there are further improvements that can be made - such as what should be considered to be the "layout height" - they may require larger changes elsewhere in the code. This change largely impacts, and improves, the calculated width.)
Improve glyph rasterization by using subpixeloffset64
Improves some glyph spacing issues

@past-due past-due added this to the 3.3.0_beta2 milestone Mar 31, 2019

@past-due past-due merged commit e6aa879 into Warzone2100:master Mar 31, 2019

8 checks passed

LGTM analysis: C/C++ No new or fixed alerts
LGTM analysis: JavaScript No code changes detected
LGTM analysis: Python No code changes detected
WIP Ready for review
continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
freebsd_build FreeBSD:freebsd-11-2-release-amd64 Task Summary
freebsd_build FreeBSD:freebsd-12-0-release-amd64 Task Summary

@past-due past-due deleted the past-due:2019_03_28_text_fixes_2 branch Mar 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.