static HB_Script theCurrentScript;
-static unichar UTF16GetChar(uint16 *string, int * nw)
+static unichar UTF16GetChar(const uint16 *string, int * nw)
{
unichar ch;
if(HB_IsHighSurrogate(string[0]) && HB_IsLowSurrogate(string[1]))
return ch;
}
-static HB_Bool hb_stringToGlyphs(HB_Font font, uint16 * string, uint length, HB_Glyph *glyphs, uint *numGlyphs, HB_Bool rightToLeft)
+static HB_Bool hb_stringToGlyphs(HB_Font font, const uint16 * string, uint length, HB_Glyph *glyphs, uint *numGlyphs, HB_Bool rightToLeft)
{
FT_Face face = ((FontEntry)font->userData).face;
int glyph_pos = 0;
}
}
-static HB_Bool hb_canRender(HB_Font font, uint16 * string, uint length)
+static HB_Bool hb_canRender(HB_Font font, const uint16 * string, uint length)
{
FT_Face face = ((FontEntry)font->userData).face;
int c, nw;
~FontEntry()
{
- char * fileName = (char *)key;
- delete fileName;
+ delete (char *)key;
delete buffer;
if(hbFace)
HB_FreeFace(hbFace);
char * occurence;
if(RegEnumValue(key, value++, entryName, &size, null, (PDWORD)&type, (LPBYTE)fontFileName, &sizeFileName) != ERROR_SUCCESS)
break;
- if((occurence = SearchString((char *)entryName, 0, (char *)font->elfFullName, false, false)))
+ if((occurence = SearchString(entryName, 0, (const char *)font->elfFullName, false, false)))
{
int c;
for(c = (int)(occurence - entryName) - 1; c >= 0; c--)
}
}
- Font LoadFont(DisplaySystem displaySystem, char * faceName, float size, FontFlags flags)
+ Font LoadFont(DisplaySystem displaySystem, const char * faceName, float size, FontFlags flags)
{
void * result = null;
#if !defined(__WIN32__)
File linkCfg;
#endif
- char * ecereFonts = getenv("ECERE_FONTS");
+ const char * ecereFonts = getenv("ECERE_FONTS");
if(!ecereFonts) ecereFonts = "<:ecere>";
#if !defined(__WIN32__)
{
}
#if !defined(ECERE_NOTRUETYPE)
- void ::ProcessString(Font font, DisplaySystem displaySystem, byte * text, int len,
+ void ::ProcessString(Font font, DisplaySystem displaySystem, const byte * text, int len,
void (* callback)(Surface surface, Display display, int x, int y, GlyphInfo * glyph, Bitmap bitmap),
Surface surface, Display display, int * x, int y)
{
else
{
HB_Script curScript = HB_Script_Common;
- byte * scriptStart = text + c;
+ const byte * scriptStart = text + c;
//unichar nonASCIIch = 0;
unichar ch;
unichar ahead = 0;
unichar testChar = 0;
#if !defined(__WIN32__) && !defined(ECERE_NOFONTCONFIG)
- char * testLang = null;
+ const char * testLang = null;
#endif
while(true)
{
HB_Script script = HB_Script_Common;
- ch = UTF8GetChar((char *)text + c, &nb);
+ ch = UTF8GetChar((const char *)text + c, &nb);
//if(ch > 127) nonASCIIch = ch;
if(!nb) break;
if(ch == 32 && curScript)
if(a < c + len)
{
int nb;
- unichar ahead = UTF8GetChar((char *)text + a, &nb);
+ unichar ahead = UTF8GetChar((const char *)text + a, &nb);
if((ahead >= 0x590 && ahead <= 0x7C0) || (ahead >= 0xFB1D && ahead <= 0xFB4F) || (ahead >= 0xFB50 && ahead <= 0xFDFF))
script = curScript;
}
utf16 = renew utf16 uint16[max];
utf16BufferSize = max;
}
- wc = UTF8toUTF16BufferLen((char *)scriptStart, utf16, max, len);
+ wc = UTF8toUTF16BufferLen((const char *)scriptStart, utf16, max, len);
theCurrentScript = glyphScript = curScript;
}
switch(curScript)
}
#endif
- void FontExtent(DisplaySystem displaySystem, Font font, byte * text, int len, int * width, int * height)
+ void FontExtent(DisplaySystem displaySystem, Font font, const char * text, int len, int * width, int * height)
{
if(displaySystem && displaySystem.flags.text && len)
{
{
int w = 0;
#if !defined(ECERE_NOTRUETYPE)
- ProcessString(font, displaySystem, text, len, null, null, null, &w, 0);
+ ProcessString(font, displaySystem, (const byte *)text, len, null, null, null, &w, 0);
#endif
//*width = (w + 64 - w % 64) >> 6;
*width = w >> 6;
}
#endif
- void WriteText(Display display, Surface surface, int x, int y, byte * text, int len)
+ void WriteText(Display display, Surface surface, int x, int y, const char * text, int len)
{
LFBSurface lfbSurface = surface.driverData;
if(display && display.displaySystem.flags.text)
lfbSurface.writingText = true;
#if !defined(ECERE_NOTRUETYPE)
x <<= 6;
- ProcessString(lfbSurface.font, surface.displaySystem, text, len, OutputGlyph, surface, display, &x, y);
+ ProcessString(lfbSurface.font, surface.displaySystem, (const byte *)text, len, OutputGlyph, surface, display, &x, y);
#endif
lfbSurface.writingText = false;
}
}
- void TextExtent(Display display, Surface surface, byte * text, int len, int * width, int * height)
+ void TextExtent(Display display, Surface surface, const char * text, int len, int * width, int * height)
{
LFBSurface lfbSurface = surface.driverData;
FontExtent(surface.displaySystem, lfbSurface.font, text, len, width, height);