浏览代码

fix font name

/main
fzhangtj 6 年前
当前提交
501c6b49
共有 2 个文件被更改,包括 5 次插入6 次删除
  1. 3
      README.md
  2. 8
      Runtime/ui/painting/txt/font_manager.cs

3
README.md


// Application.targetFrameRate = 60; // or higher if you want a smoother scrolling experience.
// if you want to use your own font or font icons.
// use the font family name instead of the file name in FontStyle.fontFamily.
// you can get the font family name by clicking the font file and check its Inspector.
// use the asset name of font (file name without extension) in FontStyle.fontFamily.
// FontManager.instance.addFont(Resources.Load<Font>(path: "path to your font"));
}

8
Runtime/ui/painting/txt/font_manager.cs


font.hideFlags = HideFlags.DontSave & ~HideFlags.DontSaveInBuild;
FontInfo current;
var name = font.fontNames[0];
var name = font.name;
D.assert(current == null || current.font == font, $"font with name {name} already exists, object name={font.name}");
D.assert(current == null || current.font == font, $"font with name {name} already exists");
var fontInfo = new FontInfo(font);
this._fonts[name] = fontInfo;
}

D.assert(fontInfo.font.fontNames[0] == name);
D.assert(fontInfo.font.name == name);
return fontInfo;
}

osFont.material.mainTexture.hideFlags = HideFlags.DontSave;
var newFont = new FontInfo(osFont);
this._fonts[osFont.fontNames[0]] = newFont;
this._fonts[osFont.name] = newFont;
return newFont;
}

正在加载...
取消
保存