Skip to content

Commit

Permalink
fix: actually fix zeroing shifts
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Dec 15, 2024
1 parent b9443c0 commit 324d4c2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ interface FontShiftHandler {
val shiftVectors: Set<Vector2f>

operator fun get(shift: Vector2f = Vector2f()): Identifier {
if (shift.x == 0.0f && shift.y == 0.0f) {
return fontId
}

val closest = getClosest(shift)
return FontProvider.createShiftedFontId(fontId, closest)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class VerticalFontShiftHandler(

val shifts: SortedSet<Float> = ranges.flatMap(ShiftRange::collectShifts).toSortedSet()

override val shiftVectors: Set<Vector2f> = shifts.map { Vector2f(0.0f, it) }.toSet()
override val shiftVectors: Set<Vector2f> = shifts.map { Vector2f(0.0f, it) }.toSet() + Vector2f()

operator fun get(shift: Float): Identifier {
return this[Vector2f(0.0f, shift)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ class FontProvider(

companion object {
fun createShiftedFontId(fontId: Identifier, shift: Vector2f): Identifier {
if (shift.x == 0.0f && shift.y == 0.0f) {
return fontId
}

val shiftString = "${shift.x}_${shift.y}"
return fontId.withPath { "${it}_shift_$shiftString" }
}
Expand Down

0 comments on commit 324d4c2

Please sign in to comment.