|
@@ -1,7 +1,7 @@
|
|
|
#include "Font.h"
|
|
#include "Font.h"
|
|
|
|
|
|
|
|
-#include "Image.h"
|
|
|
|
|
#include "Globals.h"
|
|
#include "Globals.h"
|
|
|
|
|
+#include "Image.h"
|
|
|
#include "Scroll.h"
|
|
#include "Scroll.h"
|
|
|
#include "Text.h"
|
|
#include "Text.h"
|
|
|
#ifdef WIN32
|
|
#ifdef WIN32
|
|
@@ -135,8 +135,7 @@ void Alphabet::setFontSize(int gr) // sets the font size
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// constant
|
|
// constant
|
|
|
-Character* Alphabet::getCharacter(
|
|
|
|
|
- unsigned char i) const // returns a character
|
|
|
|
|
|
|
+Character* Alphabet::getCharacter(unsigned char i) const // returns a character
|
|
|
{
|
|
{
|
|
|
if (zeichen[i]) return dynamic_cast<Character*>(zeichen[i]->getThis());
|
|
if (zeichen[i]) return dynamic_cast<Character*>(zeichen[i]->getThis());
|
|
|
return 0;
|
|
return 0;
|
|
@@ -164,6 +163,14 @@ AlphabetArray::AlphabetArray()
|
|
|
memset(alphabets, 0, sizeof(Alphabet*) * 256);
|
|
memset(alphabets, 0, sizeof(Alphabet*) * 256);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+Framework::AlphabetArray::~AlphabetArray()
|
|
|
|
|
+{
|
|
|
|
|
+ for (int i = 0; i < 256; ++i)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (alphabets[i]) alphabets[i]->release();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// non-constant
|
|
// non-constant
|
|
|
bool AlphabetArray::addAlphabet(Alphabet* alphabet) // Adds an alphabet
|
|
bool AlphabetArray::addAlphabet(Alphabet* alphabet) // Adds an alphabet
|
|
|
{
|
|
{
|
|
@@ -215,8 +222,7 @@ Font::~Font()
|
|
|
delete alphabet;
|
|
delete alphabet;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-bool Font::addAlphabet(
|
|
|
|
|
- Alphabet* alphabet) // Adds an alphabet to the font
|
|
|
|
|
|
|
+bool Font::addAlphabet(Alphabet* alphabet) // Adds an alphabet to the font
|
|
|
{
|
|
{
|
|
|
if (this->alphabet->addAlphabet(alphabet))
|
|
if (this->alphabet->addAlphabet(alphabet))
|
|
|
{
|
|
{
|
|
@@ -473,8 +479,7 @@ void TextRenderer::renderText(int x,
|
|
|
const Point& zRObjOff = zRObj.getDrawOff();
|
|
const Point& zRObjOff = zRObj.getDrawOff();
|
|
|
int beginX = x;
|
|
int beginX = x;
|
|
|
int zh = getRowHeight();
|
|
int zh = getRowHeight();
|
|
|
- if (y + (zh + lineSpacing) * Text(txt).countOf('\n') + zh + zRObjOff.y
|
|
|
|
|
- < 0
|
|
|
|
|
|
|
+ if (y + (zh + lineSpacing) * Text(txt).countOf('\n') + zh + zRObjOff.y < 0
|
|
|
|| x + zRObjOff.x >= zRObjBr || y + zRObjOff.y >= zRObjHi)
|
|
|| x + zRObjOff.x >= zRObjBr || y + zRObjOff.y >= zRObjHi)
|
|
|
return;
|
|
return;
|
|
|
bool faerb = 0;
|
|
bool faerb = 0;
|
|
@@ -490,15 +495,13 @@ void TextRenderer::renderText(int x,
|
|
|
if (txt[i] == ' ')
|
|
if (txt[i] == ' ')
|
|
|
{
|
|
{
|
|
|
if (faerb)
|
|
if (faerb)
|
|
|
- zRObj.alphaRegion(
|
|
|
|
|
- x, y, fontSize / 2 + charSpacing, zh, ff);
|
|
|
|
|
|
|
+ zRObj.alphaRegion(x, y, fontSize / 2 + charSpacing, zh, ff);
|
|
|
x += fontSize / 2 + charSpacing;
|
|
x += fontSize / 2 + charSpacing;
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
if (txt[i] == '\t')
|
|
if (txt[i] == '\t')
|
|
|
{
|
|
{
|
|
|
- if (faerb)
|
|
|
|
|
- zRObj.alphaRegion(x, y, fontSize + charSpacing, zh, ff);
|
|
|
|
|
|
|
+ if (faerb) zRObj.alphaRegion(x, y, fontSize + charSpacing, zh, ff);
|
|
|
x += fontSize + charSpacing;
|
|
x += fontSize + charSpacing;
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
@@ -654,8 +657,7 @@ void TextRenderer::renderChar(int& x,
|
|
|
if (underlined)
|
|
if (underlined)
|
|
|
zRObj.drawLineHAlpha(x - (int)(charSpacing / 2.0 + 0.5),
|
|
zRObj.drawLineHAlpha(x - (int)(charSpacing / 2.0 + 0.5),
|
|
|
y + getRowHeight() + getCharSpacing() / 2,
|
|
y + getRowHeight() + getCharSpacing() / 2,
|
|
|
- fontSize / 2 + charSpacing
|
|
|
|
|
- + (int)(charSpacing / 2.0 + 0.5),
|
|
|
|
|
|
|
+ fontSize / 2 + charSpacing + (int)(charSpacing / 2.0 + 0.5),
|
|
|
0xFF000000 | color);
|
|
0xFF000000 | color);
|
|
|
x += fontSize / 2 + charSpacing;
|
|
x += fontSize / 2 + charSpacing;
|
|
|
}
|
|
}
|
|
@@ -670,8 +672,7 @@ void TextRenderer::renderChar(int& x,
|
|
|
if (underlined)
|
|
if (underlined)
|
|
|
zRObj.drawLineHAlpha(x - (int)(charSpacing / 2.0 + 0.5),
|
|
zRObj.drawLineHAlpha(x - (int)(charSpacing / 2.0 + 0.5),
|
|
|
y + getRowHeight() + getCharSpacing() / 2,
|
|
y + getRowHeight() + getCharSpacing() / 2,
|
|
|
- fontSize + charSpacing
|
|
|
|
|
- + (int)(charSpacing / 2.0 + 0.5),
|
|
|
|
|
|
|
+ fontSize + charSpacing + (int)(charSpacing / 2.0 + 0.5),
|
|
|
0xFF000000 | color);
|
|
0xFF000000 | color);
|
|
|
x += fontSize + charSpacing;
|
|
x += fontSize + charSpacing;
|
|
|
}
|
|
}
|
|
@@ -955,8 +956,7 @@ void EngravedTextRenderer::renderChar(int& x,
|
|
|
if (underlined)
|
|
if (underlined)
|
|
|
zRObj.drawLineHAlpha(x - (int)(charSpacing / 2.0 + 0.5),
|
|
zRObj.drawLineHAlpha(x - (int)(charSpacing / 2.0 + 0.5),
|
|
|
y + getRowHeight() + getCharSpacing() / 2,
|
|
y + getRowHeight() + getCharSpacing() / 2,
|
|
|
- fontSize / 2 + charSpacing
|
|
|
|
|
- + (int)(charSpacing / 2.0 + 0.5),
|
|
|
|
|
|
|
+ fontSize / 2 + charSpacing + (int)(charSpacing / 2.0 + 0.5),
|
|
|
0xFF000000 | color);
|
|
0xFF000000 | color);
|
|
|
x += fontSize / 2 + charSpacing;
|
|
x += fontSize / 2 + charSpacing;
|
|
|
}
|
|
}
|
|
@@ -971,8 +971,7 @@ void EngravedTextRenderer::renderChar(int& x,
|
|
|
if (underlined)
|
|
if (underlined)
|
|
|
zRObj.drawLineHAlpha(x - (int)(charSpacing / 2.0 + 0.5),
|
|
zRObj.drawLineHAlpha(x - (int)(charSpacing / 2.0 + 0.5),
|
|
|
y + getRowHeight() + getCharSpacing() / 2,
|
|
y + getRowHeight() + getCharSpacing() / 2,
|
|
|
- fontSize + charSpacing
|
|
|
|
|
- + (int)(charSpacing / 2.0 + 0.5),
|
|
|
|
|
|
|
+ fontSize + charSpacing + (int)(charSpacing / 2.0 + 0.5),
|
|
|
0xFF000000 | color);
|
|
0xFF000000 | color);
|
|
|
x += fontSize + charSpacing;
|
|
x += fontSize + charSpacing;
|
|
|
}
|
|
}
|
|
@@ -1052,14 +1051,12 @@ void ItalicTextRenderer::renderChar(int& x,
|
|
|
int xp = x + zRObjOff.x, yp = y + zRObjOff.y;
|
|
int xp = x + zRObjOff.x, yp = y + zRObjOff.y;
|
|
|
int xStartBuffer = xp < zRObjPos.x ? (zRObjPos.x - xp) : 0,
|
|
int xStartBuffer = xp < zRObjPos.x ? (zRObjPos.x - xp) : 0,
|
|
|
yStartBuffer = yp < zRObjPos.y ? (zRObjPos.y - yp) : 0;
|
|
yStartBuffer = yp < zRObjPos.y ? (zRObjPos.y - yp) : 0;
|
|
|
- int bufferWidth = b->getWidth(),
|
|
|
|
|
- bufferHeight = b->getHeight();
|
|
|
|
|
|
|
+ int bufferWidth = b->getWidth(), bufferHeight = b->getHeight();
|
|
|
unsigned char colorAlpha = (unsigned char)(255 - (color >> 24));
|
|
unsigned char colorAlpha = (unsigned char)(255 - (color >> 24));
|
|
|
color &= 0x00FFFFFF;
|
|
color &= 0x00FFFFFF;
|
|
|
double xStepBuffer
|
|
double xStepBuffer
|
|
|
= (double)b->getFontSize() / (double)fontSize,
|
|
= (double)b->getFontSize() / (double)fontSize,
|
|
|
- yStepBuffer
|
|
|
|
|
- = (double)b->getFontSize() / (double)fontSize;
|
|
|
|
|
|
|
+ yStepBuffer = (double)b->getFontSize() / (double)fontSize;
|
|
|
double xBuffer = xStartBuffer * xStepBuffer,
|
|
double xBuffer = xStartBuffer * xStepBuffer,
|
|
|
yBuffer = yStartBuffer * yStepBuffer;
|
|
yBuffer = yStartBuffer * yStepBuffer;
|
|
|
int charHeight = getCharHeight(c);
|
|
int charHeight = getCharHeight(c);
|
|
@@ -1130,8 +1127,7 @@ void ItalicTextRenderer::renderChar(int& x,
|
|
|
if (underlined)
|
|
if (underlined)
|
|
|
zRObj.drawLineHAlpha(x - (int)(charSpacing / 2.0 + 0.5),
|
|
zRObj.drawLineHAlpha(x - (int)(charSpacing / 2.0 + 0.5),
|
|
|
y + getRowHeight() + getCharSpacing() / 2,
|
|
y + getRowHeight() + getCharSpacing() / 2,
|
|
|
- fontSize / 2 + charSpacing
|
|
|
|
|
- + (int)(charSpacing / 2.0 + 0.5),
|
|
|
|
|
|
|
+ fontSize / 2 + charSpacing + (int)(charSpacing / 2.0 + 0.5),
|
|
|
0xFF000000 | color);
|
|
0xFF000000 | color);
|
|
|
x += fontSize / 2 + charSpacing;
|
|
x += fontSize / 2 + charSpacing;
|
|
|
}
|
|
}
|
|
@@ -1146,8 +1142,7 @@ void ItalicTextRenderer::renderChar(int& x,
|
|
|
if (underlined)
|
|
if (underlined)
|
|
|
zRObj.drawLineHAlpha(x - (int)(charSpacing / 2.0 + 0.5),
|
|
zRObj.drawLineHAlpha(x - (int)(charSpacing / 2.0 + 0.5),
|
|
|
y + getRowHeight() + getCharSpacing() / 2,
|
|
y + getRowHeight() + getCharSpacing() / 2,
|
|
|
- fontSize + charSpacing
|
|
|
|
|
- + (int)(charSpacing / 2.0 + 0.5),
|
|
|
|
|
|
|
+ fontSize + charSpacing + (int)(charSpacing / 2.0 + 0.5),
|
|
|
0xFF000000 | color);
|
|
0xFF000000 | color);
|
|
|
x += fontSize + charSpacing;
|
|
x += fontSize + charSpacing;
|
|
|
}
|
|
}
|