From 387f1214f0629fba2d2a7418bed63e0ba33bd85e Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 26 Nov 2022 17:25:52 +0000 Subject: [PATCH] Add some heuristics to guess a better font overbar offset. Fixes https://gitlab.com/kicad/code/kicad/issues/13010 --- common/font/outline_font.cpp | 24 +++++++++++++++++++++--- common/font/stroke_font.cpp | 2 +- include/font/outline_font.h | 4 ++-- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/common/font/outline_font.cpp b/common/font/outline_font.cpp index ac48618ae3..4ce2d4af52 100644 --- a/common/font/outline_font.cpp +++ b/common/font/outline_font.cpp @@ -297,6 +297,22 @@ VECTOR2I OUTLINE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector>* aGlyphs, const wxString& aText, const VECTOR2I& aSize, const VECTOR2I& aPosition, const EDA_ANGLE& aAngle, @@ -418,6 +434,7 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphs( BOX2I* aBBox, std::vectorsize->metrics.ascender * GLYPH_SIZE_SCALER ); + int height = abs( face->size->metrics.height * GLYPH_SIZE_SCALER ); int descender = abs( face->size->metrics.descender * GLYPH_SIZE_SCALER ); VECTOR2I extents( cursor.x * scaleFactor.x, ( ascender + descender ) * abs( scaleFactor.y ) ); @@ -441,17 +458,18 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphs( BOX2I* aBBox, std::vector>& aGlyphs ) const; VECTOR2I getTextAsGlyphs( BOX2I* aBoundingBox, std::vector>* aGlyphs, @@ -165,8 +167,6 @@ private: static constexpr double m_subscriptVerticalOffset = -0.25; static constexpr double m_superscriptVerticalOffset = 0.45; - static constexpr double m_overbarOffsetRatio = -0.15; - static constexpr double m_overbarThicknessRatio = 0.08; }; } //namespace KIFONT