Ivan Savenko 1 年之前
父节点
当前提交
b624069f86
共有 2 个文件被更改,包括 11 次插入2 次删除
  1. 1 1
      .github/workflows/github.yml
  2. 10 1
      client/renderSDL/CTrueTypeFont.cpp

+ 1 - 1
.github/workflows/github.yml

@@ -352,7 +352,7 @@ jobs:
           run: |
             find . -path ./.git -prune -o -path ./AI/FuzzyLite -prune -o -path ./test/googletest \
             -o -path ./osx  -prune -o -type f \
-            -not -name '*.png' -and -not -name '*.vcxproj*' -and -not -name '*.props' -and -not -name '*.wav' -and -not -name '*.webm' -and -not -name '*.ico' -and -not -name '*.bat' -print0 | \
+            -not -name '*.png' -and -not -name '*.ttf' -and -not -name '*.wav' -and -not -name '*.webm' -and -not -name '*.ico' -and -not -name '*.bat' -print0 | \
             { ! xargs -0 grep -l -z -P '\r\n'; }
 
         - name: Validate JSON

+ 10 - 1
client/renderSDL/CTrueTypeFont.cpp

@@ -94,7 +94,16 @@ size_t CTrueTypeFont::getGlyphWidthScaled(const char *data) const
 
 bool CTrueTypeFont::canRepresentCharacter(const char * data) const
 {
-	return TTF_GlyphIsProvided32(font.get(), TextOperations::getUnicodeCodepoint(data, TextOperations::getUnicodeCharacterSize(*data)));
+	uint32_t codepoint = TextOperations::getUnicodeCodepoint(data, TextOperations::getUnicodeCharacterSize(*data));
+#if SDL_TTF_VERSION_ATLEAST(2, 0, 18)
+	return TTF_GlyphIsProvided32(font.get(), codepoint);
+#elif SDL_TTF_VERSION_ATLEAST(2, 0, 12)
+	if (codepoint <= 0xffff)
+		return TTF_GlyphIsProvided(font.get(), codepoint);
+	return true;
+#else
+	return true;
+#endif
 }
 
 size_t CTrueTypeFont::getStringWidthScaled(const std::string & data) const