From 3c9a18675c9d37a778789f2601f80a477712f97a Mon Sep 17 00:00:00 2001 From: halx99 Date: Thu, 17 Jun 2021 21:56:38 +0800 Subject: [PATCH] Add some comment for pr #384 --- cocos/2d/CCFontFreeType.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cocos/2d/CCFontFreeType.cpp b/cocos/2d/CCFontFreeType.cpp index fb802947b1..181a0e635d 100644 --- a/cocos/2d/CCFontFreeType.cpp +++ b/cocos/2d/CCFontFreeType.cpp @@ -233,8 +233,12 @@ bool FontFreeType::createFontObject(const std::string &fontName, float fontSize) // store the face globally _fontRef = face; auto* ttSize = (TT_Size)(_fontRef->size); + // Notes: + // a. ttSize->metrics->height: (ttSize->metrics->ascender - ttSize->metrics->descender) + // b. ftSize->metrics.height == ttSize->metrics->height + // c. the TT spec always asks for ROUND, not FLOOR or CEIL, see also freetype: ttobjs.c _lineHeight = static_cast((ttSize->metrics->ascender - ttSize->metrics->descender) >> 6); - + // done and good return true; }