mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-20 03:55:47 +08:00
126 lines
3.8 KiB
C++
126 lines
3.8 KiB
C++
#ifndef _FONT_CONSTS_H
|
|
#define _FONT_CONSTS_H
|
|
|
|
#include "GlyphBitmap.h"
|
|
#include <math.h>
|
|
|
|
#include <ft2build.h>
|
|
#include FT_FREETYPE_H
|
|
#include FT_GLYPH_H
|
|
|
|
//---------------------------------------------------------------------------------------------------
|
|
|
|
#define UNKNOWN_CHARSET 3 // äëÿ ñëó÷àåâ, êîãäà çàäàíî çíà÷åíèå DEFAULT_CHARSET, íî
|
|
// íà ñàìîì äåëå charset íå ó÷èòûâàåòñÿ
|
|
|
|
//---------------------------------------------------------------------------------------------------
|
|
|
|
#define MAX_FONT_CACHE_SIZE 16
|
|
#define MAX_FONT_NAME_LEN 50
|
|
#define MAX_FONT_STYLE_LEN 40
|
|
|
|
//---------------------------------------------------------------------------------------------------
|
|
// Íåêîòîðûå êîíñòàíòû, çàòðàãèâàþùèå ðèñîâàíèå ãëèôîâ
|
|
//---------------------------------------------------------------------------------------------------
|
|
|
|
#define FONT_FRACTION_BITS 2
|
|
#define FONT_FRACTION (1 << FONT_FRACTION_BITS)
|
|
#define FONT_FRACTION_MULT ((double)1 / (double)FONT_FRACTION)
|
|
|
|
#define FONT_ITALIC_ANGLE 0.3090169943749 // Ñèíóñ 18 ãðàäóñîâ (ïîäáèðàëîñü ïîä Word 2007)
|
|
|
|
//---------------------------------------------------------------------------------------------------
|
|
// Ñòðóêòóðà äëÿ õðàíåíèÿ èíôîðìàöèè î ñèìâîëå â ñòðîêå
|
|
//---------------------------------------------------------------------------------------------------
|
|
|
|
enum EGlyphState
|
|
{
|
|
glyphstateNormal = 0, // ñèìâîë îòðèñîâàëñÿ â íóæíîì øðèôòå
|
|
glyphstateDeafault, // ñèìâîë îòðèñîâàëñÿ â äåôîëòîâîì øðèôòå
|
|
glyphstateMiss // ñèìâîë íå îòðèñîâàëñÿ
|
|
};
|
|
|
|
struct TGlyph
|
|
{
|
|
long lUnicode; // Þíèêîä
|
|
float fX; // Ïîçèöèÿ ãëèôà
|
|
float fY; // íà BaseLine
|
|
|
|
float fLeft; //
|
|
float fTop; // BBox
|
|
float fRight; //
|
|
float fBottom; //
|
|
|
|
struct TMetrics
|
|
{
|
|
float fWidth;
|
|
float fHeight;
|
|
|
|
float fHoriBearingX;
|
|
float fHoriBearingY;
|
|
float fHoriAdvance;
|
|
|
|
float fVertBearingX;
|
|
float fVertBearingY;
|
|
float fVertAdvance;
|
|
} oMetrics;
|
|
|
|
EGlyphState eState;
|
|
|
|
bool bBitmap;
|
|
TGlyphBitmap oBitmap;
|
|
};
|
|
|
|
namespace FontConstants
|
|
{
|
|
|
|
//---------------------------------------------------------------------------------------------------
|
|
// Êîíñòàíòû ñâÿçàííûå ñ CharMap: Platform, Encoding ID
|
|
//---------------------------------------------------------------------------------------------------
|
|
|
|
const long c_lUniPlatform = 0;
|
|
const long c_lMacPlatform = 1;
|
|
const long c_lWinPlatform = 3;
|
|
|
|
const long c_lWinEncSymbol = 0;
|
|
const long c_lWinEncUSC2 = 1;
|
|
const long c_lWinEncShiftJIS = 2;
|
|
const long c_lWinEncPRC = 3;
|
|
const long c_lWinEncBig5 = 4;
|
|
const long c_lWinEncWansung = 5;
|
|
const long c_lWinEncJohab = 6;
|
|
const long c_lWinEncUCS4 = 10;
|
|
|
|
//--------------------------------------------------------------------------
|
|
// FontStyle: face types and common styles
|
|
//--------------------------------------------------------------------------
|
|
|
|
enum FontStyle
|
|
{
|
|
FontStyleRegular = 0,
|
|
FontStyleBold = 1,
|
|
FontStyleItalic = 2,
|
|
FontStyleBoldItalic = 3,
|
|
FontStyleUnderline = 4,
|
|
FontStyleStrikeout = 8
|
|
};
|
|
|
|
//--------------------------------------------------------------------------
|
|
// Unit constants
|
|
//--------------------------------------------------------------------------
|
|
|
|
enum Unit
|
|
{
|
|
UnitWorld, // 0 -- World coordinate (non-physical unit)
|
|
UnitDisplay, // 1 -- Variable -- for PageTransform only
|
|
UnitPixel, // 2 -- Each unit is one device pixel.
|
|
UnitPoint, // 3 -- Each unit is a printer's point, or 1/72 inch.
|
|
UnitInch, // 4 -- Each unit is 1 inch.
|
|
UnitDocument, // 5 -- Each unit is 1/300 inch.
|
|
UnitMillimeter // 6 -- Each unit is 1 millimeter.
|
|
};
|
|
|
|
|
|
};
|
|
|
|
#endif /* _FONT_CONSTS_H */ |