Skip to content

Commit

Permalink
Fix incorrect calculation of vertical shift (maplibre#22)
Browse files Browse the repository at this point in the history
In [this PR](https://github.com/maplibre/maplibre-gl-native/pull/270/files#diff-d57cd3143ace69af2f7ae79a917ac1328acc7543ae8a2a15f58b4635b86f1b91R148) in the maplibre there was a typo during adding `static_cast<float>`.  And because of this the logic of calculation `shiftY` is broken. This PR makes it correct.



| Before | After |
| - | - |
| <img width="390" alt="image" src="https://user-images.githubusercontent.com/8909650/168667685-587d1ca4-54a2-435c-99ed-0be575304b68.png"> |  <img width="388" alt="image" src="https://user-images.githubusercontent.com/8909650/168667701-85940ff2-66a5-4e47-828e-573279ea5620.png"> |
  • Loading branch information
rmyhal authored May 16, 2022
1 parent 54dd7b5 commit fca853f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lyft-scripts/build-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -euo pipefail

# Set the version here! This should be updated on every patch and every MapLibre version change.
readonly VERSION_NAME="9.5.2-patch-4"
readonly VERSION_NAME="9.5.2-patch-5"

# Set the artifact ID, artifact name, & artifactory URL here. This shouldn't change.
readonly ARTIFACT_ID="android-sdk"
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/text/shaping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void align(Shaping& shaping,
if (maxLineHeight != lineHeight) {
shiftY = -blockHeight * verticalAlign - Shaping::yOffset;
} else {
shiftY = (-verticalAlign * static_cast<float>(lineCount + 0.5)) * lineHeight;
shiftY = (-verticalAlign * static_cast<float>(lineCount) + 0.5f) * lineHeight;
}

for (auto& line : shaping.positionedLines) {
Expand Down

0 comments on commit fca853f

Please sign in to comment.