YSTest: Font.h 源文件

YSTest PreAlpha_b900_20201012 The YSLib Test Project

Font.h
浏览该文件的文档.
1 /*
2 © 2009-2019 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YSL_INC_Adaptor_Font_h_
29 #define YSL_INC_Adaptor_Font_h_ 1
30
31 #include "../Core/YModules.h"
32 #include YFM_YSLib_Core_YFunc
33 #include YFM_YSLib_Core_YObject
34 #include <string>
35 #include YFM_YSLib_Core_YException
36 #include YFM_YSLib_Adaptor_YTextBase
37 #include <ystdex/hash.hpp> // for ystdex::hash_combine_seq;
38 #include <ystdex/cache.hpp>
39 //#include <ft2build.h>
40 //#include FT_FREETYPE_H
41
43
44 struct FT_SizeRec_;
45 using FT_Size = ::FT_SizeRec_*;
46 using FT_SizeRec = ::FT_SizeRec_;
47 struct FT_FaceRec_;
48 using FT_FaceRec = ::FT_FaceRec_;
49 struct FT_GlyphSlotRec_;
50 using FT_GlyphSlot = ::FT_GlyphSlotRec_*;
51 struct FT_LibraryRec_;
52 using FT_Library = ::FT_LibraryRec_*;
53 struct FT_Size_Metrics_;
54 using FT_Size_Metrics = FT_Size_Metrics_;
56
57 namespace YSLib
58 {
59
60 namespace Drawing
61 {
62
63 class Font;
64 class FontCache;
65 class FontFamily;
66 class Typeface;
67
68
73 using FontSize = std::uint8_t;
78 using FontPath = string;
83 using FamilyName = string;
88 using StyleName = string;
89
90
95 enum class FontStyle : std::uint8_t
96 {
97 Regular = 0,
98 Bold = 1,
99 Italic = 2,
100 Underline = 4,
101 Strikeout = 8
102 };
103
108 DefBitmaskEnum(FontStyle)
109
110
111
116 YB_ATTR_nodiscard YB_ATTR_returns_nonnull YB_PURE yconstfn
117 PDefH(const char*, FetchName, FontStyle style) ynothrow
118 ImplRet(style == FontStyle::Bold ? "Bold" : (style == FontStyle::Italic
119 ? "Italic" : (style == FontStyle::Underline ? "Underline" : (style
120 == FontStyle::Strikeout ? "Strikeout" : "Regular"))))
121
122
123
127 class YF_API FontException : public LoggedEvent
128 {
129 public:
131 using FontError = int;
132
133 private:
134 FontError err;
135
136 public:
138 FontException(FontError e, const string_view msg = "")
139 : LoggedEvent(msg),
140 err(e)
141 {}
143 DefDeCopyCtor(FontException)
148 ~FontException() override;
149
150 DefGetter(const ynothrow, FontError, ErrorCode, err)
151 };
152
153
158 class YF_API NativeFontSize final : private noncopyable
159 {
160 private:
161 ::FT_Size size;
162
163 public:
165 NativeFontSize(::FT_FaceRec&, FontSize);
166 NativeFontSize(NativeFontSize&&) ynothrow;
168 ~NativeFontSize();
169
170 YB_ATTR_nodiscard YB_PURE ::FT_SizeRec&
171 GetSizeRec() const;
172
178 void
179 Activate() const;
180 };
181
182
187 class YF_API FontFamily final : private noncopyable
188 {
189 public:
191 using FaceMap = map<const StyleName, lref<Typeface>>;
192
193 private:
194 FamilyName family_name;
195
196 protected:
198 FaceMap mFaces;
199
200 public:
205 FontFamily(const FamilyName&);
206
211 void
212 operator+=(Typeface&);
217 bool
218 operator-=(Typeface&) ynothrow;
219
220 DefGetter(const ynothrow, const FamilyName&, FamilyName, family_name)
222
223
227 YB_ATTR_nodiscard YB_PURE observer_ptr<Typeface>
228 GetTypefacePtr(FontStyle) const;
230 YB_ATTR_nodiscard YB_PURE observer_ptr<Typeface>
231 GetTypefacePtr(const StyleName&) const;
233 YB_ATTR_nodiscard YB_PURE Typeface&
235 GetTypefaceRef(FontStyle) const;
237 YB_ATTR_nodiscard YB_PURE Typeface&
238 GetTypefaceRef(const StyleName&) const;
239 };
240
241
246 class YF_API Typeface final : private noncopyable, private nonmovable
247 {
249 friend class Font;
251 friend class CharBitmap;
252
253 private:
255
256 struct BitmapKey
257 {
259 unsigned Flags;
261 unsigned GlyphIndex;
262 FontSize Size;
264 FontStyle Style;
265
267 friend PDefHOp(bool, ==, const BitmapKey& x, const BitmapKey& y)
268 ynothrow
269 ImplRet(x.Flags == y.Flags && x.GlyphIndex == y.GlyphIndex
270 && x.Size == y.Size && x.Style == y.Style)
271 };
272
273 struct BitmapKeyHash
274 {
275 PDefHOp(size_t, (), const BitmapKey& key) const ynothrow
276 ImplRet(ystdex::hash_combine_seq(size_t(key.Style), key.Size,
277 key.GlyphIndex, key.Flags))
278 };
279
280 class SmallBitmapData
281 {
282 friend class CharBitmap;
283
284 private:
290 std::uint8_t width = 255, height = 0;
292 signed char left = 0, top = 0;
294 std::uint8_t format = 0, max_grays = 0;
295 short pitch = 0;
296 signed char xadvance = 0, yadvance = 0;
298 std::uint8_t* buffer = {};
300
301 public:
303 SmallBitmapData(::FT_GlyphSlot, FontStyle);
304 SmallBitmapData(SmallBitmapData&&);
305 ~SmallBitmapData();
306 };
308
310 long face_index;
312 int cmap_index;
313 StyleName style_name;
315 pair<lref<FontFamily>, lref<::FT_FaceRec_>> ref;
317 mutable ystdex::used_list_cache<BitmapKey, SmallBitmapData, BitmapKeyHash>
318 bitmap_cache;
320 mutable unordered_map<char32_t, unsigned> glyph_index_cache;
322 mutable unordered_map<FontSize, NativeFontSize> size_cache;
323
324 public:
329 Typeface(FontCache&, const FontPath&, std::uint32_t = 0);
331 ~Typeface();
332
333 DefGetterMem(const ynothrow, FamilyName, FamilyName, GetFontFamily())
338 DefGetter(const ynothrow, const FontFamily&, FontFamily, ref.first)
339 DefGetter(const ynothrow, const StyleName&, StyleName, style_name)
344 DefGetter(const ynothrow, int, CMapIndex, cmap_index)
345
346 private:
348
349 SmallBitmapData&
350 LookupBitmap(const BitmapKey&) const;
351
353 YB_ATTR_nodiscard unsigned
354 LookupGlyphIndex(char32_t) const;
355
357 YB_ATTR_nodiscard NativeFontSize&
358 LookupSize(FontSize) const;
359
360 public:
361 PDefH(void, ClearBitmapCache, )
362 ImplExpr(bitmap_cache.clear())
363
364 PDefH(void, ClearGlyphIndexCache, )
365 ImplExpr(glyph_index_cache.clear())
367
369 PDefH(void, ClearSizeCache, )
370 ImplExpr(size_cache.clear())
371 };
372
373
379 YB_ATTR_nodiscard YF_API const Typeface&
380 FetchDefaultTypeface();
381
382
388 class YF_API CharBitmap final
389 {
390 public:
392 using BufferType = std::uint8_t*;
397 enum FormatType
398 {
399 None = 0,
400 Mono,
401 Gray,
402 Gray2,
403 Gray4,
404 LCD,
405 LCD_V
406 };
408 using NativeType = Typeface::SmallBitmapData*;
413 using PitchType = short;
415 using ScaleType = std::uint8_t;
417 using SignedScaleType = signed char;
418
419 private:
420 NativeType bitmap = {};
421
422 public:
424
425 DefDeCtor(CharBitmap)
428 yconstfn
429 CharBitmap(NativeType b)
430 : bitmap(b)
431 {}
433
434 yconstfn DefCvt(const ynothrow, NativeType, bitmap)
435
436
441 yconstfn DefGetter(const ynothrowv, BufferType, Buffer,
442 Deref(bitmap).buffer)
443 yconstfn DefGetter(const ynothrowv, FormatType, Format,
444 FormatType(Deref(bitmap).format))
445 yconstfn DefGetter(const ynothrowv, ScaleType, GrayLevel,
446 Deref(bitmap).max_grays)
447 yconstfn DefGetter(const ynothrowv, ScaleType, Height, Deref(bitmap).height)
448 yconstfn DefGetter(const ynothrowv, SignedScaleType, Left,
449 Deref(bitmap).left)
450 yconstfn DefGetter(const ynothrowv, PitchType, Pitch, Deref(bitmap).pitch)
451 yconstfn DefGetter(const ynothrowv, SignedScaleType, Top, Deref(bitmap).top)
452 yconstfn DefGetter(const ynothrowv, ScaleType, Width, Deref(bitmap).width)
453 yconstfn DefGetter(const ynothrowv, SignedScaleType, XAdvance,
454 Deref(bitmap).xadvance)
455 yconstfn DefGetter(const ynothrowv, SignedScaleType, YAdvance,
456 Deref(bitmap).yadvance)
458 };
459
460
465 class YF_API FontCache final : private noncopyable,
466 private OwnershipTag<Typeface>, private OwnershipTag<FontFamily>
467 {
468 friend class Typeface;
473 friend class Font;
474
475 public:
481 using FaceMap = map<FontPath, unique_ptr<Typeface>>;
486 using FamilyMap = unordered_map<FamilyName, unique_ptr<FontFamily>>;
487
493 static yconstexpr const size_t DefaultGlyphCacheSize = yimpl(128U << 10);
494
495 private:
497 ::FT_Library library;
498
499 protected:
504 FaceMap mFaces;
506 FamilyMap mFamilies;
511 observer_ptr<Typeface> pDefaultFace;
512
513 public:
519 explicit
520 FontCache(size_t = DefaultGlyphCacheSize);
525 ~FontCache();
526
527 public:
532 DefGetter(const ynothrow, const FaceMap&, Faces, mFaces)
534 DefGetter(const ynothrow, const FamilyMap&, FamilyIndices, mFamilies)
536
537 YB_ATTR_nodiscard YB_PURE observer_ptr<const FontFamily>
539 GetFontFamilyPtr(const FamilyName&) const;
544 YB_ATTR_nodiscard YB_PURE observer_ptr<const Typeface>
545 GetDefaultTypefacePtr() const;
547 YB_ATTR_nodiscard YB_PURE observer_ptr<const Typeface>
548 GetTypefacePtr(const FamilyName&, const StyleName&) const;
550
551 private:
556 void
557 Add(const FontPath&, unique_ptr<Typeface>);
558
559 public:
565 size_t
566 LoadTypefaces(const FontPath&);
567
573 YB_ATTR_nodiscard YB_PURE FontFamily&
574 LookupFamily(const FamilyName&);
575
579 void
580 InitializeDefaultTypeface();
581 };
582
583
588 class YF_API Font final
589 {
590 public:
591 static yconstexpr const FontSize DefaultSize = 12,
592 MinimalSize = 4, MaximalSize = 96;
593
594 private:
596 lref<Typeface> typeface;
598 FontSize font_size;
603 FontStyle style;
604
605 public:
610 Font()
611 : Font(FetchDefaultTypeface().GetFontFamily())
612 {}
617 explicit
618 Font(const FontFamily&, FontSize = DefaultSize,
619 FontStyle = FontStyle::Regular);
620
621 DefPred(const ynothrow, Bold, bool(style & FontStyle::Bold))
622 DefPred(const ynothrow, Italic, bool(style & FontStyle::Italic))
623 DefPred(const ynothrow, Underline, bool(style & FontStyle::Underline))
624 DefPred(const ynothrow, Strikeout, bool(style & FontStyle::Strikeout))
625
630 YB_ATTR_nodiscard YB_PURE std::int8_t
631 GetAdvance(char32_t, CharBitmap = {}) const;
636 YB_ATTR_nodiscard YB_PURE std::int8_t
637 GetAscender() const;
642 YB_ATTR_nodiscard YB_PURE std::int8_t
643 GetDescender() const;
644 DefGetterMem(const ynothrow, const FamilyName&, FamilyName,
645 GetFontFamily())
646 DefGetterMem(const ynothrow, const FontFamily&, FontFamily, GetTypeface())
647 DefGetter(const ynothrow, FontSize, Size, font_size)
649 DefGetter(const ynothrow, FontStyle, Style, style)
659 YB_ATTR_nodiscard YB_PURE CharBitmap
660 GetGlyph(char32_t c, yimpl(unsigned flags = 4U)) const;
665 YB_ATTR_nodiscard YB_PURE FontSize
666 GetHeight() const ynothrow;
668 DefGetter(const, StyleName, StyleName, FetchName(style))
669
670 private:
675 YB_ATTR_nodiscard YB_PURE ::FT_Size_Metrics
676 GetInternalInfo() const;
677
678 public:
683 DefGetter(const ynothrow, Typeface&, Typeface, typeface)
684
688 void
689 SetSize(FontSize = DefaultSize);
695 bool
696 SetStyle(FontStyle);
697 };
698
699 } // namespace Drawing;
700
701 } // namespace YSLib;
702
703 #endif
704
YSLib::Drawing::FontStyle::Strikeout
@ Strikeout
删除线。
YSLib::Drawing::buffer
The boundary is out of the buffer
Definition: YDraw.h:118
DefDeCtor
#define DefDeCtor(_t)
简单通用成员函数定义。
Definition: YBaseMacro.h:157
YB_ATTR_nodiscard
#define YB_ATTR_nodiscard
标记返回值不被忽略的属性。
Definition: ydef.h:715
DefPred
#define DefPred(_q, _n,...)
Definition: YBaseMacro.h:232
CHRLib::e
const char const char * e
Definition: CharacterProcessing.h:112
YSLib::Drawing::FontCache::FamilyMap
unordered_map< FamilyName, unique_ptr< FontFamily > > FamilyMap
字型家族组索引类型。
Definition: Font.h:486
DefGetterMem
#define DefGetterMem(_q, _t, _n, _m)
Definition: YBaseMacro.h:247
YSLib::Drawing::Typeface::face_index
long face_index
Definition: Font.h:310
YSLib::Drawing::FontCache::DefGetter
DefGetter(const ynothrow, const FaceMap &, Faces, mFaces) DefGetter(const ynothrow
取字型映射。
YSLib::Drawing::Size
屏幕区域大小。
Definition: YGDIBase.h:536
YSLib::Drawing::ImplRet
YB_ATTR_nodiscard YB_STATELESS yconstfn Rotation rot ImplRet(Rotation((size_t(rot)+1) % 4)) YB_ATTR_nodiscard YB_STATELESS yconstfn PDefH(Rotation
ystdex::lref
左值引用包装。
Definition: ref.hpp:61
yconstexpr
#define yconstexpr
指定编译时常量表达式。
Definition: ydef.h:1072
YB_PURE
#define YB_PURE
指示函数或函数模板实例为纯函数。
Definition: ydef.h:919
YSLib::Drawing::c
The boundary is out of the const Graphics const Rect const Point const Point Color c const Rect const Rect Color c
Definition: YDraw.h:174
ystdex::cpp2017::basic_string
Definition: string.hpp:77
YSLib::Drawing::FamilyName
string FamilyName
字型家族名称。
Definition: Font.h:83
FT_GlyphSlot
::FT_GlyphSlotRec_ * FT_GlyphSlot
Definition: Font.h:50
YSLib::Drawing::x
const TextState &ts const TextState &ts const TextState &ts TextState SPos x
Definition: TextBase.h:190
ystdex::cpp2017::string_view
basic_string_view< char > string_view
Definition: string_view.hpp:437
YSLib::Drawing::StyleName
string StyleName
字型样式名称。
Definition: Font.h:88
YSLib::Drawing::CharBitmap::LCD
@ LCD
Definition: Font.h:404
YSLib::Drawing::CharBitmap::Gray4
@ Gray4
Definition: Font.h:403
YSLib::Drawing::FontFamily::mFaces
FaceMap mFaces
字型组索引类型。
Definition: Font.h:198
YSLib::IO::int
YF_API int
Definition: File.h:51
YSLib::Drawing::CharBitmap::Mono
@ Mono
Definition: Font.h:400
hash.hpp
散列接口。
YSLib::Drawing::CharBitmap::FormatType
FormatType
Definition: Font.h:398
YSLib::Drawing::Font::DefGetterMem
DefGetterMem(const ynothrow, const FamilyName &, FamilyName, GetFontFamily()) DefGetterMem(const ynothrow
YSLib::Drawing::FontFamily::GetTypefaceRef
YB_ATTR_nodiscard YB_PURE Typeface & GetTypefaceRef(const StyleName &) const
YF_API
#define YF_API
Definition: Platform.h:56
YSLib::Drawing::FontStyle::Bold
@ Bold
粗体。
YSLib::Drawing::FontStyle::Italic
@ Italic
斜体。
YSLib::Drawing::Font::GetAscender
bool(style &FontStyle::Strikeout)) YB_ATTR_nodiscard YB_PURE std YB_ATTR_nodiscard YB_PURE std::int8_t GetAscender() const
取跨距。
Definition: Font.h:637
FT_FaceRec
::FT_FaceRec_ FT_FaceRec
Definition: Font.h:48
YSLib::Drawing::FontCache::mFaces
FaceMap mFaces
字型映射。
Definition: Font.h:504
YSLib::Drawing::FontFamily::family_name
FamilyName family_name
Definition: Font.h:194
YSLib::Drawing::Typeface
字型。
Definition: Font.h:247
YSLib::Drawing::FontCache
字体缓存。
Definition: Font.h:467
YSLib::Drawing::FontCache::mFamilies
FamilyMap mFamilies
字型家族组索引。
Definition: Font.h:506
ystdex::used_list_cache
按最近使用策略刷新的缓存。
Definition: cache.hpp:175
YSLib::Drawing::Typeface::DefGetterMem
DefGetterMem(const ynothrow, FamilyName, FamilyName, GetFontFamily()) DefGetter(const ynothrow
取字型家族。
FT_SizeRec
::FT_SizeRec_ FT_SizeRec
Definition: Font.h:46
ystdex::hash_combine_seq
size_t hash_combine_seq(size_t seed, const _type &val)
重复计算序列散列。
Definition: hash.hpp:67
ystdex::map< const StyleName, lref< Typeface > >
YSLib::Drawing::Typeface::style_name
StyleName style_name
Definition: Font.h:313
YSLib::Drawing::FontCache::library
::FT_Library library
库实例。
Definition: Font.h:497
YSLib::Drawing::PDefH
YB_ATTR_nodiscard YB_PURE yconstfn PDefH(Size, Transpose, const Size &s) ynothrow ImplRet(
转置。
Definition: YGDIBase.h:763
YSLib::Drawing::Typeface::BitmapKey::Style
FontStyle Style
Definition: Font.h:264
YSLib::Drawing::Typeface::BitmapKeyHash
Definition: Font.h:274
YSLib::Drawing::FontCache::pDefaultFace
observer_ptr< Typeface > pDefaultFace
默认字型指针。
Definition: Font.h:511
ystdex::bases::nonmovable
不可转移对象：禁止继承此类的对象调用默认原型的转移构造函数和转移赋值操作符。
Definition: base.h:90
YB_ATTR_returns_nonnull
#define YB_ATTR_returns_nonnull
指示返回非空属性。
Definition: ydef.h:761
YSLib::Drawing::CharBitmap::ScaleType
std::uint8_t ScaleType
Definition: Font.h:415
YSLib::LoggedEvent
记录日志的异常事件类。
Definition: YException.h:51
YSLib::Drawing::Typeface::glyph_index_cache
unordered_map< char32_t, unsigned > glyph_index_cache
Definition: Font.h:320
YSLib::Drawing::CharBitmap::BufferType
std::uint8_t * BufferType
Definition: Font.h:392
YSLib::Drawing::Font::Font
Font()
无参数构造：使用默认字型家族、大小和样式的字体对象。
Definition: Font.h:610
YSLib::Drawing::FontFamily
字型家族。
Definition: Font.h:188
YSLib::Drawing::CharBitmap
字符位图。
Definition: Font.h:389
YSLib::Drawing::CharBitmap::Gray2
@ Gray2
Definition: Font.h:402
cache.hpp
高速缓冲容器模板。
std
Definition: optional.h:982
platform::containers::unordered_map
std::unordered_map< _tKey, _tMapped, _fHash, _fEqual, _tAlloc > unordered_map
Definition: Container.h:133
YSLib::yimpl
YF_API yimpl(GUIApplication &) FetchGlobalInstance()
取全局应用程序实例。
YSLib::Drawing::CharBitmap::DefCvt
yconstfn DefCvt(const ynothrow, NativeType, bitmap) yconstfn DefGetter(const ynothrowv
YSLib::Drawing::Typeface::BitmapKey::GlyphIndex
unsigned GlyphIndex
Definition: Font.h:261
YSLib::OwnershipTag
指定对参数指定类型的成员具有所有权的标签。
Definition: YObject.h:91
YSLib::Drawing::Typeface::BitmapKey::Flags
unsigned Flags
Definition: Font.h:259
platform::KeyCategory::None
@ None
表示未分配或保留的键。
Definition: Keys.h:101
YSLib::UI::y
SPos SPos y
Definition: YWidget.cpp:44
YSLib::Drawing::Typeface::size_cache
unordered_map< FontSize, NativeFontSize > size_cache
Definition: Font.h:322
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:46
YSLib::Drawing::PDefHOp
YB_ATTR_nodiscard yconstfn YB_PURE x x x Bottom YB_ATTR_nodiscard yconstfn YB_PURE PDefHOp(Padding,+, const Padding &x, const Padding &y) ynothrow ImplRet(Padding(x.Left+y.Left
加法：对应分量调用 operator+ 。
YSLib::Activate
Activate
Definition: YApplication.h:210
YSLib::Drawing::Typeface::cmap_index
int cmap_index
Definition: Font.h:312
YSLib::Drawing::Typeface::ref
pair< lref< FontFamily >, lref<::FT_FaceRec_ > > ref
Definition: Font.h:315
YSLib::Drawing::FetchName
FetchName
Definition: Font.h:117
YSLib::Drawing::ynothrow
YB_ATTR_nodiscard yconstfn YB_PURE x x x Bottom YB_ATTR_nodiscard yconstfn YB_PURE x Right y x Top y x Bottom y Bottom YB_ATTR_nodiscard yconstfn YB_PURE x Right y x Top y x Bottom y Bottom YB_ATTR_nodiscard yconstfn YB_PURE const Padding & ynothrow
Definition: YGDI.h:132
YSLib::Drawing::ImplExpr
const TextState &ts const TextState &ts const TextState &ts TextState SPos SPos y ImplExpr(ts.Pen=Point(x, y)) YF_API void SetCurrentTextLineNOf(TextState &
设置笔的行位置。
platform::Deref
YB_PURE yconstfn auto Deref(_type &&p) -> decltype(*p)
断言并解引用非空指针。
Definition: Debug.h:547
YSLib::Drawing::Font::font_size
FontSize font_size
Definition: Font.h:598
YSLib::Drawing::Top
YB_ATTR_nodiscard yconstfn YB_PURE x x Top
Definition: YGDI.h:108
ynothrowv
#define ynothrowv
YSLib 无异常抛出保证验证：有条件地使用无异常抛出规范。
Definition: ydef.h:1219
YSLib::Drawing::CharBitmap::PitchType
short PitchType
Definition: Font.h:413
YSLib::Drawing::FontFamily::DefGetter
DefGetter(const ynothrow, const FamilyName &, FamilyName, family_name) YB_ATTR_nodiscard YB_PURE observer_ptr< Typeface > GetTypefacePtr(FontStyle) const
取指定样式的字型指针。
DefDeCopyCtor
#define DefDeCopyCtor(_t)
Definition: YBaseMacro.h:162
YSLib::Drawing::CharBitmap::Gray
@ Gray
Definition: Font.h:401
FT_Library
::FT_LibraryRec_ * FT_Library
Definition: Font.h:52
YSLib::Drawing::FontStyle::Underline
@ Underline
下划线。
YSLib::Drawing::Typeface::bitmap_cache
ystdex::used_list_cache< BitmapKey, SmallBitmapData, BitmapKeyHash > bitmap_cache
Definition: Font.h:318
YSLib::Drawing::FontSize
std::uint8_t FontSize
字体大小。
Definition: Font.h:73
YSLib::Drawing::Font::DefPred
DefPred(const ynothrow, Bold, bool(style &FontStyle::Bold)) DefPred(const ynothrow
YSLib::Drawing::Font::typeface
lref< Typeface > typeface
Definition: Font.h:596
FT_Size
::FT_SizeRec_ * FT_Size
Definition: Font.h:45
YSLib::Drawing::Font
字体：字模，包含字型、样式和大小。
Definition: Font.h:589
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:241
DefBitmaskEnum
#define DefBitmaskEnum(_tEnum)
Definition: YBaseMacro.h:505
YSLib::Drawing::FontStyle::Regular
@ Regular
常规字体。
YSLib::Drawing::Typeface::BitmapKey
Definition: Font.h:257
YSLib::Drawing::Font::style
FontStyle style
字体样式。
Definition: Font.h:603
platform::KeyCodes::DS::Left
@ Left
Definition: Keys.h:222
YSLib::Drawing::Typeface::BitmapKey::Size
FontSize Size
Definition: Font.h:262
const
const Decapsulate const Decapsulate &y ynothrow ContextNode &ctx const
Definition: NPLA1Forms.cpp:1629
YSLib::Drawing::CharBitmap::SignedScaleType
signed char SignedScaleType
Definition: Font.h:417
ystdex::cpp2017::string
basic_string< char > string
Definition: string.hpp:772
YSLib::Drawing::GetHeight
YB_ATTR_nodiscard YB_PURE tr GetHeight())) inline PDefH(void
按字体高度和行距调整文本区域的底边距。
platform_ex::Windows::ErrorCode
unsigned long ErrorCode
Definition: Win32/include/YCLib/MinGW32.h:58
YSLib::Drawing::char32_t
YB_ATTR_nodiscard YB_PURE tr TextRegion &tr char32_t
Definition: TextLayout.h:93
ystdex::bases::noncopyable
不可复制对象：禁止派生类调用默认原型的复制构造函数和复制赋值操作符。
Definition: base.h:50
YSLib::Drawing::NativeFontSize
字体异常。
Definition: Font.h:159
YSLib::Drawing::Typeface::SmallBitmapData
Definition: Font.h:281
YSLib::Drawing::FontStyle
FontStyle
字体样式。
Definition: Font.h:96
YSLib::Drawing::FontPath
string FontPath
字体文件路径。
Definition: Font.h:78
ystdex::ref
void ref(const _type &&)=delete
YSLib::Drawing::NativeFontSize::size
::FT_Size size
Definition: Font.h:161
yconstfn
#define yconstfn
指定编译时常量函数。
Definition: ydef.h:1073
YSLib::Drawing::FetchDefaultTypeface
YB_ATTR_nodiscard YF_API const Typeface & FetchDefaultTypeface()
取默认字型引用。
Definition: Font.cpp:391
FT_Size_Metrics
FT_Size_Metrics_ FT_Size_Metrics
Definition: Font.h:54