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

Fix city label & note locations #1

Merged
merged 2 commits into from
Jul 25, 2021
Merged

Fix city label & note locations #1

merged 2 commits into from
Jul 25, 2021

Conversation

Qrox
Copy link

@Qrox Qrox commented Jul 24, 2021

Sometimes city label and note's background and text do not strictliy align, when the overmap font and normal font has different sizes or when overmap window size is not dividable by the tile size.

This fixes it by:

  1. Correctly implement string drawing. The ch parameter of OutputChar is assumed by Font classes to be a single utf-8 encoded unicode codepoint. Passing a string to OutputChar incidentally works, but the drawing position need to be hacked to correctly position the string, and OutputChar may render text incorrectly if characters after the first one needs to be drawn with a fallback font. There are also some android-specific code that needs to be updated to use draw_string, but I don't have the environment to test it, so I'll leave it for @ZhilkinSerg.
  2. Use utf8_width to get the correct print length of strings.
  3. Center city labels, and left and top-align notes.
  4. Use font instead of overmap_font, because the code uses fontwidth and fontheight which are font's properties.
  5. Mark "Notes: " to be translated.
  6. Remove some unused variables.

@GoLoT
Copy link
Owner

GoLoT commented Jul 24, 2021

I think I'm done with my changes so there shouldn't be any new conflicts from now on. I'll merge as soon as you resolve the conflicts unless you want me to do it.

@Qrox
Copy link
Author

Qrox commented Jul 25, 2021

I've rebased the changes.

@GoLoT GoLoT merged commit ae229e6 into GoLoT:overmap_notes Jul 25, 2021
@Qrox Qrox deleted the overmap branch July 26, 2021 12:32
GoLoT pushed a commit that referenced this pull request Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants