From b43d172795ba5743a6013e616c85c51118b80f19 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 13 Apr 2022 15:09:45 -0700 Subject: [PATCH] move baseline alignment to position 0 --- include/Wellspring.h | 2 +- src/Wellspring.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/Wellspring.h b/include/Wellspring.h index 2c33c6e..21a7a63 100644 --- a/include/Wellspring.h +++ b/include/Wellspring.h @@ -103,9 +103,9 @@ typedef enum Wellspring_HorizontalAlignment typedef enum Wellspring_VerticalAlignment { + WELLSPRING_VERTICALALIGNMENT_BASELINE, WELLSPRING_VERTICALALIGNMENT_TOP, WELLSPRING_VERTICALALIGNMENT_MIDDLE, - WELLSPRING_VERTICALALIGNMENT_BASELINE, WELLSPRING_VERTICALALIGNMENT_BOTTOM } Wellspring_VerticalAlignment; diff --git a/src/Wellspring.c b/src/Wellspring.c index d7032f1..2719eca 100644 --- a/src/Wellspring.c +++ b/src/Wellspring.c @@ -344,7 +344,11 @@ static float Wellspring_INTERNAL_GetVerticalAlignOffset( Wellspring_VerticalAlignment verticalAlignment, float scale ) { - if (verticalAlignment == WELLSPRING_VERTICALALIGNMENT_TOP) + if (verticalAlignment == WELLSPRING_VERTICALALIGNMENT_BASELINE) + { + return 0; + } + else if (verticalAlignment == WELLSPRING_VERTICALALIGNMENT_TOP) { return scale * font->ascent; } @@ -352,10 +356,6 @@ static float Wellspring_INTERNAL_GetVerticalAlignOffset( { return scale * (font->ascent + font->descent) / 2.0f; } - else if (verticalAlignment == WELLSPRING_VERTICALALIGNMENT_BASELINE) - { - return 0; - } else /* BOTTOM */ { return scale * font->descent;