ultimatepp/uppsrc/Draw/FontInt.h
Mirek Fidler 34ff691308 sizeof(wchar) is changed to 4 (32 bits) to support non BMP unicode characters
This might bring some incompatibilities in the code that expects wchar to be 16 bit, which
  escpecially involves dealing with Win32 (and to lesser extend MacOS) APIs, so if your application
  is doing that, please check all instances of WCHAR (UniChar on MacOS) or even wchar
  especially type casts.

  To support host APIs, char16 is introduced (but there is no 16-bit String varian).

  Use ToSystemCharsetW, FromSystemCharsetW to convert texts to Win32 API.

- Support of drawing non-BMP characters in GUI
- Vastly improved character font replacement code (when drawing characters missing with requested font, replacement font is used)
- Last instances of Win32 ANSI calls (those ending with A) are removed
- UTF handling routines are refactored and their's naming is unified
- RTF is now being able to handle non-BMP characters (RTF is used as clipboard format for RichText)

Other minor changes:

- fixed TryRealloc issue
- improved MemoryCheck
- Removed MemoryAlloc48/MemoryFree48
- In theide Background parsing should less often cause delays in the main thread
2021-12-02 12:03:19 +01:00

65 lines
1.6 KiB
C++

#ifndef _Draw_FontInt_h_
#define _Draw_FontInt_h_
// Implementation header
struct FaceInfo : Moveable<FaceInfo> {
String name;
dword info = 0;
};
struct CommonFontInfo {
int ascent;
int descent;
int external;
int internal;
int overhang;
int avewidth;
int maxwidth;
int firstchar;
int charcount;
int default_char;
int spacebefore;
int spaceafter;
bool fixedpitch;
bool scaleable;
bool ttf;
int aux;
char path[256]; // optional (linux only)
int fonti = 0; // font index in .ttc, .otc
};
class Font;
struct GlyphInfo {
int16 width;
int16 lspc;
int16 rspc;
word glyphi = 0; // optional, not available in Win32, X11
bool IsNormal() const { return (word)width != 0x8000; }
bool IsComposed() const { return !IsNormal() && (lspc == -1 || lspc == -11); }
bool IsComposedLM() const { return !IsNormal() && lspc == -11; }
bool IsReplaced() const { return !IsNormal() && lspc >= 0; }
bool IsMissing() const { return !IsNormal() && lspc == -2; }
};
void Std(Font& font);
GlyphInfo GetGlyphInfo(Font font, int chr);
const CommonFontInfo& GetFontInfo(Font font);
bool IsNormal_nc(Font font, int chr);
void GlyphMetrics(GlyphInfo& f, Font font, int chr);
void InvalidateFontList();
// Platform specific font interface
CommonFontInfo GetFontInfoSys(Font font);
GlyphInfo GetGlyphInfoSys(Font font, int chr);
Vector<FaceInfo> GetAllFacesSys();
String GetFontDataSys(Font font, const char *table, int offset, int size);
void RenderCharacterSys(FontGlyphConsumer& sw, double x, double y, int ch, Font fnt);
#endif