From d932b58cc3c181965d7e0ceff2f3822460434eed Mon Sep 17 00:00:00 2001 From: Maschell Date: Thu, 13 Aug 2020 13:48:26 +0200 Subject: [PATCH] Remove the getOffset method from FreeTypeGX --- include/gui/FreeTypeGX.h | 3 --- source/gui/FreeTypeGX.cpp | 45 --------------------------------------- 2 files changed, 48 deletions(-) diff --git a/include/gui/FreeTypeGX.h b/include/gui/FreeTypeGX.h index 75dccdc..4a7292c 100644 --- a/include/gui/FreeTypeGX.h +++ b/include/gui/FreeTypeGX.h @@ -114,7 +114,6 @@ class FreeTypeGX { private: FT_Library ftLibrary; /**< FreeType FT_Library instance. */ FT_Face ftFace; /**< FreeType reusable FT_Face typographic object. */ - int16_t ftPointSize; /**< Current set size of the rendered font. */ bool ftKerningEnabled; /**< Flag indicating the availability of font kerning data. */ uint8_t vertexIndex; /**< Vertex format descriptor index. */ GX2Sampler ftSampler; @@ -156,8 +155,6 @@ public: uint16_t getHeight(const wchar_t *text, int16_t pixelSize); - void getOffset(const wchar_t *text, int16_t pixelSize, uint16_t widthLimit = 0); - static wchar_t *charToWideChar(const char *p); static char *wideCharToUTF8(const wchar_t *strChar); diff --git a/source/gui/FreeTypeGX.cpp b/source/gui/FreeTypeGX.cpp index 10d5774..5c3c53c 100644 --- a/source/gui/FreeTypeGX.cpp +++ b/source/gui/FreeTypeGX.cpp @@ -462,51 +462,6 @@ uint16_t FreeTypeGX::getHeight(const wchar_t *text, int16_t pixelSize) { return strMax + strMin; } -/** - * Get the maximum offset above and minimum offset below the font origin line. - * - * This function calculates the maximum pixel height above the font origin line and the minimum - * pixel height below the font origin line and returns the values in an addressible structure. - * - * @param text NULL terminated string to calculate. - * @param offset returns the max and min values above and below the font origin line - * - */ -void FreeTypeGX::getOffset(const wchar_t *text, int16_t pixelSize, uint16_t widthLimit) { - if (fontData.find(pixelSize) != fontData.end()) { - return; - } - - int16_t strMax = 0, strMin = 9999; - uint16_t currWidth = 0; - - int32_t i = 0; - - while (text[i]) { - if (widthLimit > 0 && currWidth >= widthLimit) { break; } - - ftgxCharData *glyphData = cacheGlyphData(text[i], pixelSize); - - if (glyphData != NULL) { - strMax = glyphData->renderOffsetMax > strMax ? glyphData->renderOffsetMax : strMax; - strMin = glyphData->renderOffsetMin < strMin ? glyphData->renderOffsetMin : strMin; - currWidth += glyphData->glyphAdvanceX; - } - - ++i; - } - - if (ftPointSize != pixelSize) { - ftPointSize = pixelSize; - FT_Set_Pixel_Sizes(ftFace, 0, ftPointSize); - } - - fontData[pixelSize].ftgxAlign.ascender = ftFace->size->metrics.ascender >> 6; - fontData[pixelSize].ftgxAlign.descender = ftFace->size->metrics.descender >> 6; - fontData[pixelSize].ftgxAlign.max = strMax; - fontData[pixelSize].ftgxAlign.min = strMin; -} - /** * Copies the supplied texture quad to the EFB. *