Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
coretextfont.h
Go to the documentation of this file.
1 
18 #ifndef ION_TEXT_CORETEXTFONT_H_
19 #define ION_TEXT_CORETEXTFONT_H_
20 
21 #include <memory>
22 #include <string>
23 
24 #include "ion/math/vector.h"
25 #include "ion/text/font.h"
26 
27 namespace ion {
28 namespace text {
29 
34 class ION_API CoreTextFont : public Font {
35  public:
42  CoreTextFont(const std::string& name, size_t size_in_pixels,
43  size_t sdf_padding, const void* data, size_t data_size);
44 
48  std::string GetCTFontName() const;
49 
51  GlyphIndex GetDefaultGlyphForChar(CharIndex char_index) const override;
52  const Layout BuildLayout(const std::string& text,
53  const LayoutOptions& options) const override;
54  void AddFallbackFont(const FontPtr& fallback) override;
55 
56  protected:
57  ~CoreTextFont() override;
58 
59  bool LoadGlyphGrid(GlyphIndex glyph_index,
60  GlyphGrid* glyph_grid) const override;
61 
62  private:
64  class Helper;
65  std::unique_ptr<Helper> helper_;
66 };
67 
70 
71 } // namespace text
72 } // namespace ion
73 
74 #endif // ION_TEXT_CORETEXTFONT_H_
std::string text
base::ReferentPtr< CoreTextFont >::Type CoreTextFontPtr
Convenience typedef for shared pointer to a CoreTextFont.
Definition: coretextfont.h:69
This represents a single CoreText font.
Definition: coretextfont.h:34
uint32 CharIndex
Typedef for a Unicode index of a character.
Definition: font.h:35
This struct defines parameters affecting layout of a single text string when passed to BuildLayout()...
Definition: layout.h:101
std::string name
Definition: printer.cc:324
A Layout instance specifies how glyphs are arranged to form text.
Definition: layout.h:127
A grid representing a rendered glyph, with each grid pixel representing pixel coverage in the range (...
Definition: font.h:48
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
Definition: sharedptr.h:60
Font is a base class for implementation-specific representations of fonts.
Definition: font.h:43