MWAWFontConverter Class Reference

a namespace used to convert Mac font characters in unicode More...

#include <MWAWFontConverter.hxx>

Public Types

enum  Encoding { E_DEFAULT , E_SJIS }
 the character encoding type More...
 

Public Member Functions

 MWAWFontConverter ()
 the constructor
 
 ~MWAWFontConverter ()
 the destructor
 
int getId (std::string const &name, std::string family="") const
 returns an unique id > 255, if unknown
 
std::string getName (int macId) const
 returns empty string if unknown
 
void setCorrespondance (int macId, std::string const &name, std::string family="")
 fixes the name corresponding to an id
 
void getOdtInfo (int macId, std::string &name, int &deltaSize) const
 final font name and a delta which can be used to change the size if no name is found, return "Times New Roman"
 
int unicode (int macId, unsigned char c) const
 converts a character in unicode
 
int unicode (int macId, unsigned char c, MWAWInputStreamPtr &input) const
 converts a character in unicode, if needed can read the next input caracter
 
int unicode (int macId, unsigned char c, unsigned char const *(&str), int len) const
 converts a character in unicode, if needed can read the next input caracter in str
 

Static Protected Member Functions

static std::string getValidName (std::string const &name)
 check if a string is valid, if not, convert it to a valid string
 

Protected Attributes

std::shared_ptr< MWAWFontConverterInternal::Statem_manager
 the main manager
 

Detailed Description

a namespace used to convert Mac font characters in unicode

On old mac system, a font is either determined by a name or an unique id. The standart font have a "fixed" id < 35, the user font can have different id, (ie. when you installed a font with some id, if a font with the same id already exists, a new id will generated for this font). Unfortunatly, Microsoft files seem to only store the font id....

A font also consists in 256 independent characters which are not normalised (and a user can easily modify a characters of a font).

Member Enumeration Documentation

◆ Encoding

the character encoding type

Enumerator
E_DEFAULT 
E_SJIS 

Constructor & Destructor Documentation

◆ MWAWFontConverter()

MWAWFontConverter::MWAWFontConverter ( )

the constructor

◆ ~MWAWFontConverter()

MWAWFontConverter::~MWAWFontConverter ( )

the destructor

Member Function Documentation

◆ getId()

int MWAWFontConverter::getId ( std::string const &  name,
std::string  family = "" 
) const

returns an unique id > 255, if unknown

◆ getName()

std::string MWAWFontConverter::getName ( int  macId) const

returns empty string if unknown

◆ getOdtInfo()

void MWAWFontConverter::getOdtInfo ( int  macId,
std::string &  name,
int &  deltaSize 
) const

final font name and a delta which can be used to change the size if no name is found, return "Times New Roman"

◆ getValidName()

std::string MWAWFontConverter::getValidName ( std::string const &  name)
staticprotected

check if a string is valid, if not, convert it to a valid string

Referenced by getId(), and setCorrespondance().

◆ setCorrespondance()

void MWAWFontConverter::setCorrespondance ( int  macId,
std::string const &  name,
std::string  family = "" 
)

fixes the name corresponding to an id

◆ unicode() [1/3]

int MWAWFontConverter::unicode ( int  macId,
unsigned char  c 
) const

converts a character in unicode

Returns
-1 if the character is not transformed

Referenced by MWAWCellContent::FormulaInstruction::getPropertyList().

◆ unicode() [2/3]

int MWAWFontConverter::unicode ( int  macId,
unsigned char  c,
MWAWInputStreamPtr input 
) const

converts a character in unicode, if needed can read the next input caracter

Returns
-1 if the character is not transformed

◆ unicode() [3/3]

int MWAWFontConverter::unicode ( int  macId,
unsigned char  c,
unsigned char const *&  str,
int  len 
) const

converts a character in unicode, if needed can read the next input caracter in str

Returns
-1 if the character is not transformed

Member Data Documentation

◆ m_manager

std::shared_ptr<MWAWFontConverterInternal::State> MWAWFontConverter::m_manager
mutableprotected

the main manager

Referenced by getId(), getName(), getOdtInfo(), setCorrespondance(), and unicode().


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

Generated on Thu Jan 19 2023 00:00:00 for libmwaw by doxygen 1.9.6