3#ifndef PDFSDK_CXX_PDF_FONT_H_INCLUDED_
4#define PDFSDK_CXX_PDF_FONT_H_INCLUDED_
14#include <pdfsdk/cxx/bytes.h>
15#include <pdfsdk/cxx/math.h>
16#include <pdfsdk/cxx/read_stream.h>
18#include "forward_declarations.h"
19#include "wrapper_base.h"
30class Font :
public detail::RefCountedHandle<PDEFont> {
246 int16_t
GetCharWidth(
const char* codepoint,
size_t codepointLen)
const;
376 std::optional<PDFontInfo>
FindSubstFontInfo(
bool forceBold =
false,
bool forceItalic =
false)
const;
508 std::wstring
CharToUnicode(
const char* codepoint,
size_t codepointLen,
bool useOnlyToUnicode =
false)
const;
518 std::wstring
CharToUnicode(
const std::string& codepoint,
bool useOnlyToUnicode =
false)
const;
527 std::string
UnicodeToChar(
const UnicodeChar* unicode,
size_t unicodeLen)
const;
549 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Font, PDEFont)
555 virtual void MoveTo(
const PDPointF& to) = 0;
556 virtual void LineTo(
const PDPointF& to) = 0;
564using FontSubstitutionID = uint32_t;
583bool RemoveFontNameSubstitution(FontSubstitutionID
id);
604bool RemoveCIDFontSubstitution(FontSubstitutionID
id);
608#include "font_impl.inl"
Represents a content array.
Definition content.h:29
Represents a PDF document.
Definition document.h:27
Matrix GetFontMatrix() const
Get the font transformation matrix.
bool HasValidWidths() const
std::string UnicodeToChar(const std::wstring &unicode) const
Convert the specified Unicode value to its character code equivalent.
Object GetPdfObject() const
Get the PDF object associated with this Font object.
RectF GetType3GlyphsBBox() const
Get the bounding box of the Type 3 glyphs.
ReadStream OpenFontFileStream() const
Open the embedded font program as a read stream.
PDAtom GetName() const
Get the name of the font.
std::wstring CharToUnicode(const std::string &codepoint, bool useOnlyToUnicode=false) const
Convert the specified character code to its Unicode equivalent.
bool HasValidToUnicodeMap(PDEFontToUnicodeCheckFlags checkFlags=0) const
PDEType3GlyphInfo GetType3GlyphInfo(uint8_t charcode) const
PDEFontMetrics GetMetrics() const
Get the metrics of the font.
void EnumCharOutline(const std::string &codepoint, OutlineEnumMonitor &mon) const
Enumerate the outline of a character by specifying its character code.
bool HasRenderableGlyphs() const
void SetType3CharProc(uint8_t charcode, const PDEType3GlyphInfo &glyphInfo, const Content &content)
bool IsEmbedded() const
Check if the font has an embedded font program.
RectF GetFontBBox() const
Get the font bounding box.
bool CanTypeUnicode(const std::wstring &unicode) const
Check if the font can type the specified Unicode string.
static Font CreateFromPdfObject(const Object &object)
Creates a font from the specified PDF object.
void CreateCIDSet(PDF::Document document)
PDFontStyle GetStyle() const
Get the style of the font.
PDEGlyphVertMetric GetCharVertMetric(const std::string &codepoint) const
Get the vertical metrics of the character represented by the character code.
std::string UnicodeToChar(const UnicodeChar *unicode, size_t unicodeLen) const
Convert the specified Unicode value to its character code equivalent.
bool HasValidCharSet() const
void CreateWidths(PDF::Document document)
PDEWritingMode GetWritingMode() const
Get the writing mode of the font.
PDFontInfo GetFauxFontInfo() const
Get the substitute faux font info.
size_t GetFontFileSize() const
Get the size, in bytes, of the decoded embedded font program.
PDEFontFileFormat GetFontFileFormat() const
Get the format of the embedded font program.
PDFontInfo GetFontInfo() const
Get the font info.
std::wstring CharToUnicode(const char *codepoint, size_t codepointLen, bool useOnlyToUnicode=false) const
Convert the specified character code to its Unicode equivalent.
PDAtom GetEncodingName() const
Get the encoding name of the font.
PDEGlyphVertMetric GetCharVertMetric(const char *codepoint, size_t codepointLen) const
Get the vertical metrics of the character represented by the character code and the number of bytes u...
void EnumCharOutline(const char *codepoint, size_t codepointLen, OutlineEnumMonitor &mon) const
Enumerate the outline of a character by specifying its character code and number of bytes used to rep...
bool HasValidCIDSet() const
std::optional< PDFontInfo > FindSubstFontInfo(bool forceBold=false, bool forceItalic=false) const
Finds the system font that would be substituted for this font.
std::vector< Byte > GetFontFileData() const
Get the embedded font program bytes.
bool IsGlyphPresent(const std::string &codepoint) const
int16_t GetCharWidth(const char *codepoint, size_t codepointLen) const
Get the width of the character represented by the specified character code and the number of bytes us...
void CreateCharSet(PDF::Document document)
void CreateToUnicodeMap(PDF::Document document, PDEFontToUnicodeCreateFlags createFlags=kPDEFontToUnicodeCreateDefault)
bool IsFauxed() const
Check if the font is fauxed.
bool IsGlyphPresent(const char *codepoint, size_t codepointLen) const
PDEFontSubtype GetSubtype() const
Get the subtype of the font.
Content GetType3CharProc(uint8_t charcode) const
Retrieves the glyph description for a character code.
int16_t GetCharWidth(const std::string &codepoint) const
Get the width of the character represented by the specified character code.
Represents a PDF object.
Definition object.h:25
Represents a read stream for reading data from PDF objects.
Definition read_stream.h:19
PDEFontFileFormat
Identifies the format of an embedded font program.
Definition content.h:662
PDEWritingMode
Specifies the writing orientation of any CIDFont. This is the WMode key from the CMap stream dictiona...
Definition content.h:775
PDEFontSubtype
Specifies the font subtype or type (if there is no subtype).
Definition content.h:640
@ kPDEFontToUnicodeCreateDefault
Definition content.h:295
PDFontStyle
Specifies the styling to apply to a font.
Definition fonts.h:24
@ kPDFontStyleRegular
Definition fonts.h:25
Specifies the CIDSystemInfo dictionary.
Definition content.h:750
Specifies the vertical metrics of CIDFonts.
Definition content.h:761
Specifies the glyph information for Type3 fonts extracted from d0 and d1 operators in the content str...
Definition content.h:722
Specifies the font information.
Definition fonts.h:36
Definition math_types.h:12