28 #ifndef YSL_INC_Adaptor_Font_h_
29 #define YSL_INC_Adaptor_Font_h_ 1
31 #include "../Core/YModules.h"
32 #include YFM_YSLib_Core_YFunc
33 #include YFM_YSLib_Core_YObject
35 #include YFM_YSLib_Core_YException
36 #include YFM_YSLib_Adaptor_YTextBase
37 #include YFM_YSLib_Core_Cache
43 #include FT_FREETYPE_H
173 using FaceMap = map<const StyleName, Typeface*>;
247 ImplRet(Flags == key.Flags && GlyphIndex == key.GlyphIndex
248 &&
Size == key.
Size && Style == key.Style)
273 pair<std::reference_wrapper<FontFamily>,
274 std::reference_wrapper<::FT_FaceRec_>>
ref;
314 DefGetter(const ynothrow, ::FT_Int, CMapIndex, cmap_index)
323 LookupGlyphIndex(
ucs4_t) const;
330 PDefH(
void, ClearBitmapCache, )
365 Mono = ::FT_PIXEL_MODE_MONO,
367 Gray2 = ::FT_PIXEL_MODE_GRAY2,
368 Gray4 = ::FT_PIXEL_MODE_GRAY4,
369 LCD = ::FT_PIXEL_MODE_LCD,
370 LCD_V = ::FT_PIXEL_MODE_LCD_V
395 FormatType(bitmap->
format))
418 friend class Typeface;
426 using FaceSet = set<Typeface*, ystdex::deref_comp<const Typeface>>; \
429 using FamilyMap = unordered_map<FamilyName, unique_ptr<FontFamily>>;
454 FontCache(
size_t = DefaultGlyphCacheSize);
482 GetDefaultTypefacePtr() const;
489 GetTypefacePtr(const
FamilyName&, const StyleName&) const;
497 operator+=(unique_ptr<FontFamily>);
503 operator+=(Typeface&);
510 operator-=(FontFamily&);
516 operator-=(Typeface&);
538 InitializeDefaultTypeface();
550 MinimalSize = 4, MaximalSize = 96;
569 :
Font(FetchDefaultTypeface().GetFontFamily())
610 GetDescender() const;
611 DefGetterMem(const ynothrow, const FamilyName&, FamilyName,
613 DefGetterMem(const ynothrow, const FontFamily&, FontFamily, GetTypeface())
626 GetGlyph(
ucs4_t c, ::FT_UInt flags = FT_LOAD_RENDER | FT_LOAD_TARGET_NORMAL)
633 GetHeight() const ynothrow;
634 DefGetter(const ynothrow, StyleName, StyleName, FetchName(style))
642 GetInternalInfo() const;
649 DefGetter(const ynothrow, Typeface&, Typeface, typeface)
655 SetSize(FontSize = DefaultSize);
FamilyMap mFamilies
字型家族组索引。
std::string FamilyName
字型家族名称。
static auto first(const _tIterator &i) -> decltype((i->first))
#define DefPred(_q, _n,...)
bool operator<(const path< _tSeqCon, _tNorm > &x, const path< _tSeqCon, _tNorm > &y)
DefDeCopyCtor(Font) Font(Font &&fnt)
#define DefBitmaskEnum(_tEnum)
Typeface * pDefaultFace
默认字型指针。
GMRUCache< BitmapKey, SmallBitmapData, BitmapKeyHash > bitmap_cache
pair< std::reference_wrapper< FontFamily >, std::reference_wrapper<::FT_FaceRec_ > > ref
yconstfn bool operator==(const GBinaryGroup< _type > &a, const GBinaryGroup< _type > &b) ynothrow
比较:屏幕二元组相等关系。
FontException(FontError e, const std::string &msg="")
不可复制对象:禁止派生类调用默认原型的复制构造函数和复制赋值操作符。
sizeof(AlphaType)*GetAreaOf(GetSize())) using CompactPixmap void SetSize(const Size &) override
重新设置缓冲区大小。
std::string StyleName
字型样式名称。
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
bool Activate(const shared_ptr< Shell > &hShl)
激活 Shell 对象:控制权转移给此对象以维持单线程运行。
GSStringTemplate< char >::basic_string string
YF_API const Typeface & FetchDefaultTypeface()
取默认字型引用。
std::reference_wrapper< Typeface > typeface
#define yconstfn
指定编译时常量函数。
::FT_Char SignedScaleType
map< const StyleName, Typeface * > FaceMap
字型组索引类型。
yconstfn CharBitmap(const NativeType &b)
使用本机类型对象构造字符位图对象。
#define yconstexpr
指定编译时常量表达式。
std::string FontPath
字体文件路径。
#define DefCvt(_q, _t,...)
unordered_map< FontSize, NativeFontSize > size_cache
yconstfn Size() ynothrow
无参数构造。
char32_t ucs4_t
UCS-4 字符类型。
#define DefGetterMem(_q, _t, _n, _m)
if(YB_UNLIKELY(r >=sGraphics.Height)) throw std return pBuffer r *sGraphics Width
PDefH(void, DrawLineSeg, const Graphics &g, const Rect &bounds, const Point &p1, const Point &p2, Color c) ImplExpr(DrawLineSeg(g
unordered_map< FamilyName, unique_ptr< FontFamily >> FamilyMap
字型家族组索引类型。
DefGetter(const ynothrow, AlphaType *, BufferAlphaPtr, pBufferAlpha) DefGetter(const ynothrow
取 Alpha 缓冲区的指针。
set< Typeface *, ystdex::deref_comp< const Typeface >> FaceSet
Font()
默认构造:使用默认字型家族、大小和样式的字体对象。
unordered_map< ucs4_t,::FT_UInt > glyph_index_cache
字型家族 (Typeface Family) 标识。
size_t hash_combine_seq(size_t seed, const _type &val)
重复计算序列散列。
#define DefDeCopyAssignment(_t)