Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
FontFactory Class Reference

#include <font-factory.h>

Inheritance diagram for FontFactory:
Inkscape::Util::EnableSingleton< FontFactory >

Classes

struct  Compare
 
struct  Hash
 

Public Member Functions

void refreshConfig ()
 The fontsize used as workaround for hinting.
 
Glib::ustring ConstructFontSpecification (PangoFontDescription *font)
 Constructs a pango string for use with the fontStringMap (see below)
 
Glib::ustring ConstructFontSpecification (FontInstance *font)
 
std::vector< std::string > GetAllFontNames ()
 Returns a list of all font names available in this font config.
 
Glib::ustring GetUIFamilyString (PangoFontDescription const *fontDescr)
 Returns strings to be used in the UI for family and face (or "style" as the column is labeled)
 
Glib::ustring GetUIStyleString (PangoFontDescription const *fontDescr)
 
bool hasFontFamily (std::string const &family)
 
std::map< std::string, PangoFontFamily * > GetUIFamilies ()
 
std::vector< StyleNamesGetUIStyles (PangoFontFamily *in)
 
std::vector< Glib::RefPtr< Pango::FontFamily > > get_font_families ()
 
std::shared_ptr< FontInstanceFaceFromStyle (SPStyle const *style)
 Retrieve a FontInstance from a style object, first trying to use the font-specification, the CSS information.
 
std::shared_ptr< FontInstanceFaceFromDescr (char const *family, char const *style)
 
std::shared_ptr< FontInstanceFaceFromUIStrings (char const *uiFamily, char const *uiStyle)
 
std::shared_ptr< FontInstanceFaceFromPangoString (char const *pangoString)
 
std::shared_ptr< FontInstanceFaceFromFontSpecification (char const *fontSpecification)
 
std::shared_ptr< FontInstanceFace (PangoFontDescription *descr, bool canFail=true)
 
std::unique_ptr< FontInstancecreate_face (PangoFontDescription *descr)
 
void AddFontFilesWin32 (char const *directory_path)
 
void AddFontsDir (char const *utf8dir)
 Add a directory from which to include additional fonts.
 
void AddFontFile (char const *utf8file)
 Add a an additional font.
 
PangoContext * get_font_context () const
 
PangoFontDescriptionparsePostscriptName (std::string const &name, bool substitute)
 Use font config to parse the postscript name found in pdf/ps files and return font config family and style information.
 
- Public Member Functions inherited from Inkscape::Util::EnableSingleton< FontFactory >
 EnableSingleton (EnableSingleton const &)=delete
 
EnableSingletonoperator= (EnableSingleton const &)=delete
 

Static Public Attributes

static constexpr double fontSize = 512
 

Protected Member Functions

 FontFactory ()
 
 ~FontFactory ()
 
- Protected Member Functions inherited from Inkscape::Util::EnableSingleton< FontFactory >
 EnableSingleton ()=default
 

Private Attributes

PangoFontMap * fontServer
 
PangoContext * fontContext
 
Glib::RefPtr< Pango::FontMap > _font_map
 
Inkscape::Util::cached_map< PangoFontDescription *, FontInstance, Hash, Compareloaded
 

Additional Inherited Members

- Static Public Member Functions inherited from Inkscape::Util::EnableSingleton< FontFactory >
static FontFactoryget (Args &&... args)
 
static StaticHolder< FontFactory, Depends<> > & getStaticHolder ()
 

Detailed Description

Definition at line 59 of file font-factory.h.

Constructor & Destructor Documentation

◆ FontFactory()

FontFactory::FontFactory ( )
protected

Definition at line 209 of file font-factory.cpp.

References _font_map, FactorySubstituteFunc(), and fontServer.

◆ ~FontFactory()

FontFactory::~FontFactory ( )
protected

Definition at line 222 of file font-factory.cpp.

References fontContext, fontServer, and loaded.

Member Function Documentation

◆ AddFontFile()

void FontFactory::AddFontFile ( char const *  utf8file)

Add a an additional font.

Definition at line 748 of file font-factory.cpp.

References Inkscape::IO::file_test(), and fontServer.

Referenced by end_font_face_cb().

◆ AddFontFilesWin32()

void FontFactory::AddFontFilesWin32 ( char const *  directory_path)

Definition at line 691 of file font-factory.cpp.

References Inkscape::IO::Resource::get_filenames_from_path(), and result.

Referenced by AddFontsDir().

◆ AddFontsDir()

void FontFactory::AddFontsDir ( char const *  utf8dir)

Add a directory from which to include additional fonts.

Definition at line 713 of file font-factory.cpp.

References AddFontFilesWin32(), Inkscape::IO::file_test(), and fontServer.

◆ ConstructFontSpecification() [1/2]

Glib::ustring FontFactory::ConstructFontSpecification ( FontInstance font)

Definition at line 259 of file font-factory.cpp.

References ConstructFontSpecification(), and FontInstance::get_descr().

◆ ConstructFontSpecification() [2/2]

Glib::ustring FontFactory::ConstructFontSpecification ( PangoFontDescription font)

Constructs a pango string for use with the fontStringMap (see below)

Definition at line 234 of file font-factory.cpp.

Referenced by ConstructFontSpecification().

◆ create_face()

std::unique_ptr< FontInstance > FontFactory::create_face ( PangoFontDescription descr)

Definition at line 618 of file font-factory.cpp.

References fontContext, fontServer, fontSize, and sp_font_description_get_family().

Referenced by Inkscape::get_all_fonts().

◆ Face()

◆ FaceFromDescr()

std::shared_ptr< FontInstance > FontFactory::FaceFromDescr ( char const *  family,
char const *  style 
)

Definition at line 570 of file font-factory.cpp.

References Face().

◆ FaceFromFontSpecification()

◆ FaceFromPangoString()

std::shared_ptr< FontInstance > FontFactory::FaceFromPangoString ( char const *  pangoString)

Definition at line 579 of file font-factory.cpp.

References Face(), and sp_font_description_get_family().

Referenced by FaceFromFontSpecification().

◆ FaceFromStyle()

std::shared_ptr< FontInstance > FontFactory::FaceFromStyle ( SPStyle const *  style)

Retrieve a FontInstance from a style object, first trying to use the font-specification, the CSS information.

Definition at line 542 of file font-factory.cpp.

References Face(), FaceFromFontSpecification(), SPStyle::font_specification, and ink_font_description_from_style().

Referenced by SPText::_buildLayoutInit(), and SPFlowtext::_buildLayoutInput().

◆ FaceFromUIStrings()

std::shared_ptr< FontInstance > FontFactory::FaceFromUIStrings ( char const *  uiFamily,
char const *  uiStyle 
)

◆ get_font_context()

PangoContext * FontFactory::get_font_context ( ) const
inline

Definition at line 113 of file font-factory.h.

References fontContext.

◆ get_font_families()

std::vector< Glib::RefPtr< Pango::FontFamily > > FontFactory::get_font_families ( )

Definition at line 415 of file font-factory.cpp.

References _font_map, and name.

Referenced by Inkscape::get_all_fonts().

◆ GetAllFontNames()

std::vector< std::string > FontFactory::GetAllFontNames ( )

Returns a list of all font names available in this font config.

Definition at line 365 of file font-factory.cpp.

References fontServer.

◆ GetUIFamilies()

std::map< std::string, PangoFontFamily * > FontFactory::GetUIFamilies ( )

Definition at line 386 of file font-factory.cpp.

References fontServer, and result.

Referenced by Inkscape::FontLister::FontLister().

◆ GetUIFamilyString()

Glib::ustring FontFactory::GetUIFamilyString ( PangoFontDescription const *  fontDescr)

Returns strings to be used in the UI for family and face (or "style" as the column is labeled)

Definition at line 309 of file font-factory.cpp.

References sp_font_description_get_family().

Referenced by GetUIStyles().

◆ GetUIStyles()

std::vector< StyleNames > FontFactory::GetUIStyles ( PangoFontFamily *  in)

Definition at line 442 of file font-factory.cpp.

References GetUIFamilyString(), GetUIStyleString(), and result.

◆ GetUIStyleString()

Glib::ustring FontFactory::GetUIStyleString ( PangoFontDescription const *  fontDescr)

Definition at line 327 of file font-factory.cpp.

Referenced by GetUIStyles().

◆ hasFontFamily()

bool FontFactory::hasFontFamily ( std::string const &  family)

Definition at line 381 of file font-factory.cpp.

References getSubstituteFontName().

◆ parsePostscriptName()

PangoFontDescription * FontFactory::parsePostscriptName ( std::string const &  name,
bool  substitute 
)

Use font config to parse the postscript name found in pdf/ps files and return font config family and style information.

Definition at line 815 of file font-factory.cpp.

References fontServer, name, and result.

Referenced by FontData::FontData().

◆ refreshConfig()

void FontFactory::refreshConfig ( )

The fontsize used as workaround for hinting.

Definition at line 229 of file font-factory.cpp.

References fontServer.

Referenced by Inkscape::FontLister::FontLister().

Member Data Documentation

◆ _font_map

Glib::RefPtr<Pango::FontMap> FontFactory::_font_map
private

Definition at line 124 of file font-factory.h.

Referenced by FontFactory(), and get_font_families().

◆ fontContext

PangoContext* FontFactory::fontContext
private

Definition at line 123 of file font-factory.h.

Referenced by create_face(), Face(), get_font_context(), and ~FontFactory().

◆ fontServer

PangoFontMap* FontFactory::fontServer
private

◆ fontSize

constexpr double FontFactory::fontSize = 512
staticconstexpr

Definition at line 72 of file font-factory.h.

Referenced by create_face(), and Face().

◆ loaded

Definition at line 136 of file font-factory.h.

Referenced by Face(), and ~FontFactory().


The documentation for this class was generated from the following files: