diff --git a/test/shell.d/fontconfig-cjk-test.sh b/test/shell.d/fontconfig-cjk-test.sh index c04be559..3899d78b 100755 --- a/test/shell.d/fontconfig-cjk-test.sh +++ b/test/shell.d/fontconfig-cjk-test.sh @@ -48,23 +48,23 @@ fc.FcPatternAddCharSet.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_vo fc.FcFontMatch.restype = ctypes.c_void_p fc.FcFontMatch.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_int)] for line in sys.stdin: - family, lang, char = line.split() - pattern = fc.FcPatternCreate() - fc.FcPatternAddString(pattern, b"family", family.encode()) - if lang != "-": - fc.FcPatternAddString(pattern, b"lang", lang.encode()) - if char == "families": - fc.FcConfigSubstitute(None, pattern, 0) - print(fc.FcPatternFormat(pattern, b"%{family}").decode()) - continue - if char != "-": - charset = fc.FcCharSetCreate() - fc.FcCharSetAddChar(charset, int(char, 16)) - fc.FcPatternAddCharSet(pattern, b"charset", charset) + family, lang, char = line.split() + pattern = fc.FcPatternCreate() + fc.FcPatternAddString(pattern, b"family", family.encode()) + if lang != "-": + fc.FcPatternAddString(pattern, b"lang", lang.encode()) + if char == "families": fc.FcConfigSubstitute(None, pattern, 0) - fc.FcDefaultSubstitute(pattern) - result = ctypes.c_int() - print(fc.FcPatternFormat(fc.FcFontMatch(None, pattern, ctypes.byref(result)), b"%{family[0]}").decode()) + print(fc.FcPatternFormat(pattern, b"%{family}").decode()) + continue + if char != "-": + charset = fc.FcCharSetCreate() + fc.FcCharSetAddChar(charset, int(char, 16)) + fc.FcPatternAddCharSet(pattern, b"charset", charset) + fc.FcConfigSubstitute(None, pattern, 0) + fc.FcDefaultSubstitute(pattern) + result = ctypes.c_int() + print(fc.FcPatternFormat(fc.FcFontMatch(None, pattern, ctypes.byref(result)), b"%{family[0]}").decode()) PY # resolve reads "family lang char" lines