mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Add method gid => unicode
This commit is contained in:
@ -1046,6 +1046,28 @@ int CFontFile::GetGIDByUnicode(int code)
|
||||
return unGID;
|
||||
}
|
||||
|
||||
int CFontFile::GetUnicodeByGID(int gid)
|
||||
{
|
||||
if (!m_pFace)
|
||||
return 0;
|
||||
|
||||
FT_ULong charcode;
|
||||
FT_UInt gindex;
|
||||
|
||||
charcode = FT_Get_First_Char(m_pFace, &gindex);
|
||||
|
||||
while (gindex != 0)
|
||||
{
|
||||
if (gindex == gid)
|
||||
{
|
||||
return charcode;
|
||||
}
|
||||
charcode = FT_Get_Next_Char(m_pFace, charcode, &gindex);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT CFontFile::GetString(CGlyphString& oString)
|
||||
{
|
||||
int nCountGlyph = oString.GetLength();
|
||||
|
||||
@ -254,6 +254,7 @@ public:
|
||||
double GetCharWidth(int gid);
|
||||
|
||||
int GetGIDByUnicode(int code);
|
||||
int GetUnicodeByGID(int gid);
|
||||
|
||||
int GetKerning(FT_UInt unPrevGID, FT_UInt unGID);
|
||||
void SetStringGID(const INT& bGID);
|
||||
|
||||
@ -851,6 +851,14 @@ unsigned int CFontManager::GetGIDByUnicode(const unsigned int& unCode)
|
||||
|
||||
return m_pFont->GetGIDByUnicode(unCode);
|
||||
}
|
||||
int CFontManager::GetUnicodeByGID(const int& gid)
|
||||
{
|
||||
if (!m_pFont)
|
||||
return 0;
|
||||
|
||||
return m_pFont->GetUnicodeByGID(gid);
|
||||
}
|
||||
|
||||
void CFontManager::SetSubpixelRendering(const bool& hmul, const bool& vmul)
|
||||
{
|
||||
if (hmul)
|
||||
|
||||
@ -186,6 +186,7 @@ public:
|
||||
virtual std::wstring GetFontType();
|
||||
virtual unsigned int GetNameIndex(const std::wstring& wsName);
|
||||
virtual unsigned int GetGIDByUnicode(const unsigned int& unCode);
|
||||
virtual int GetUnicodeByGID(const int& gid);
|
||||
|
||||
virtual void SetSubpixelRendering(const bool& hmul, const bool& vmul);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user