Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

相同 fontfamily 的 ttf 字体,只能成功加载一个 #2221

Open
yanjifa opened this issue Mar 3, 2020 · 0 comments
Open

相同 fontfamily 的 ttf 字体,只能成功加载一个 #2221

yanjifa opened this issue Mar 3, 2020 · 0 comments

Comments

@yanjifa
Copy link

yanjifa commented Mar 3, 2020

在 ios&mac 上出现, 其他平台未测试

cocos/scripting/js-bindings/manual/jsb_platfrom_apple.mm

这个文件加载 ttf 字体,写法有问题, 相同fontfamily 的 ttf 字体,只能成功加载一个

if (succeed)
        {
            const auto& familyNamesAfterRegister = getAvailableFontFamilyNames();
            std::string familyName = getFontFamilyByCompareAvailableFontFamilyNames(familyNamesBeforeRegister, familyNamesAfterRegister);
            if (!familyName.empty())
            {
                _fontFamilyNameMap.emplace(originalFamilyName, familyName);
                s.rval().setString(familyName);
            }
      }

上面的代码,假如我有两个字体文件,ubuntu_median.ttf、ubuntu_mediumitalic.ttf
这两个 ttf fontfamily 都是 ubuntu,就到导致后面加载的字体加载不成功

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant