diff --git a/examples/simple/TextSuiteTest.lpi b/examples/simple/TextSuiteTest.lpi
index 786f8bf..aae3bfa 100644
--- a/examples/simple/TextSuiteTest.lpi
+++ b/examples/simple/TextSuiteTest.lpi
@@ -49,6 +49,7 @@
+
diff --git a/examples/simple/TextSuiteTest.lps b/examples/simple/TextSuiteTest.lps
index 97fd7aa..7ebd904 100644
--- a/examples/simple/TextSuiteTest.lps
+++ b/examples/simple/TextSuiteTest.lps
@@ -10,7 +10,7 @@
-
+
@@ -19,35 +19,38 @@
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
-
+
@@ -56,7 +59,7 @@
-
+
@@ -65,7 +68,7 @@
-
+
@@ -73,9 +76,9 @@
-
-
-
+
+
+
@@ -84,7 +87,7 @@
-
+
@@ -92,17 +95,16 @@
-
+
-
-
+
-
+
@@ -113,7 +115,7 @@
-
+
@@ -124,7 +126,7 @@
-
+
@@ -253,26 +255,26 @@
-
+
-
+
-
+
-
+
-
+
-
+
@@ -319,18 +321,18 @@
-
+
-
+
-
+
-
+
@@ -372,8 +374,8 @@
-
-
+
+
@@ -438,7 +440,7 @@
-
+
@@ -504,133 +506,133 @@
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
diff --git a/examples/simple/uMainForm.pas b/examples/simple/uMainForm.pas
index ac7a4e7..06758c6 100644
--- a/examples/simple/uMainForm.pas
+++ b/examples/simple/uMainForm.pas
@@ -51,7 +51,6 @@ uses
const
TEST_STRING = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.';
- //TEST_STRING = 'Lorem';
procedure TMainForm.FormCreate(Sender: TObject);
var
@@ -85,9 +84,9 @@ begin
ftsGenerator.AddPostProcessStep(pp);
}
try
- ftsFont1 := ftsGenerator.GetFontByName('Calibri', ftsRenderer, 25, [tsStyleUnderline], tsAANormal);
+ ftsFont1 := ftsGenerator.GetFontByName('Calibri', ftsRenderer, 35, [tsStyleUnderline, tsStyleStrikeout], tsAANormal);
ftsFont2 := ftsGenerator.GetFontByName('Calibri', ftsRenderer, 20, [], tsAANormal);
- ftsFont3 := ftsFreeType.GetFontByFile('calibri.ttf', ftsRenderer, 25, [tsStyleUnderline], tsAANormal);
+ ftsFont3 := ftsFreeType.GetFontByFile('calibri.ttf', ftsRenderer, 35, [tsStyleUnderline, tsStyleStrikeout], tsAANormal);
except
on e: EtsException do
MessageDlg('Error', e.Message, mtError, [mbOK], 0);
@@ -157,8 +156,8 @@ begin
//block.HorzAlign := tsHorzAlignJustify;
block.ChangeFont(ftsFont1);
- block.ChangeColor(tsColor4f(1.0, 0.0, 0.0, 1.0));
- block.TextOutA(TEST_STRING + sLineBreak);
+ block.ChangeColor(tsColor4f(1.0, 1.0, 1.0, 1.0));
+ block.TextOutA(TEST_STRING + sLineBreak + sLineBreak);
block.ChangeFont(ftsFont3);
block.ChangeColor(tsColor4f(1.0, 1.0, 1.0, 1.0));
diff --git a/utsRendererOpenGL.pas b/utsRendererOpenGL.pas
index 8c2b8cf..0b7172c 100644
--- a/utsRendererOpenGL.pas
+++ b/utsRendererOpenGL.pas
@@ -266,16 +266,16 @@ var
// Text Coords
result.TextureID := aTexture^.ID;
- result.TexCoordPos.x := x / aTexture^.Size;
- result.TexCoordPos.y := y / aTexture^.Size;
+ result.TexCoordPos.x := x / aTexture^.Size;
+ result.TexCoordPos.y := y / aTexture^.Size;
result.TexCoordSize.x := aCharImage.Width / aTexture^.Size;
result.TexCoordSize.y := aCharImage.Height / aTexture^.Size;
// Vertex Coords
result.VertexPos.x := -aChar.GlyphRect.Left;
result.VertexPos.y := -aChar.GlyphRect.Top - aChar.GlyphOrigin.y;
- result.VertexSize.x := aCharImage.Width;
- result.VertexSize.y := aCharImage.Height;
+ result.VertexSize.x := aCharImage.Width;
+ result.VertexSize.y := aCharImage.Height;
glBindTexture(GL_TEXTURE_2D, result.TextureID);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
@@ -444,24 +444,6 @@ end;
procedure TtsRendererOpenGL.Render(const aCharRef: TtsCharRenderRef);
var
ref: TtsCharRenderRefOpenGL;
-
- procedure RenderTreeItem(const aItem: PtsTextureTreeItem; const X1, Y1, X2, Y2: Integer);
- begin
- glBegin(GL_LINE_LOOP);
- glVertex2f(X1, Y1);
- glVertex2f(X2, Y1);
- glVertex2f(X2, Y2);
- glVertex2f(X1, Y2);
- glEnd;
- if (aItem^.value > 0) then begin
- RenderTreeItem(aItem^.children[0], X1, Y1, X2, aItem^.value);
- RenderTreeItem(aItem^.children[1], X1, aItem^.value, X2, Y2);
- end else if (aItem^.value < 0) then begin
- RenderTreeItem(aItem^.children[0], X1, Y1, -aItem^.value, Y2);
- RenderTreeItem(aItem^.children[1], -aItem^.value, Y1, X2, Y2);
- end;
- end;
-
begin
if Assigned(aCharRef) and (aCharRef is TtsCharRenderRefOpenGL) then begin
ref := (aCharRef as TtsCharRenderRefOpenGL);
diff --git a/utsTextSuite.pas b/utsTextSuite.pas
index 8620377..2d4d5ab 100644
--- a/utsTextSuite.pas
+++ b/utsTextSuite.pas
@@ -95,8 +95,6 @@ type
procedure Blend(const aImage: TtsImage; const X, Y: Integer; const aFunc: TtsBlendFunc);
procedure Blur(const aHorzKernel, aVertKernel: TtsKernel1D; const aChannelMask: TtsColorChannels);
- procedure AddResizingBorder;
-
constructor Create;
destructor Destroy; override;
end;
@@ -948,99 +946,6 @@ begin
end;
end;
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-procedure TtsImage.AddResizingBorder;
-var
- c, cTmp, cSum: TtsColor4f;
- x, y, cnt: Integer;
- p, tmp: PByte;
-
- procedure AddCol(const aColor: TtsColor4f);
- var
- i: Integer;
- begin
- if (aColor.a > 0) then begin
- inc(cnt);
- for i := 0 to 2 do
- cSum.arr[i] := cSum.arr[i] + cTmp.arr[i];
- end;
- end;
-
-var
- i: Integer;
-begin
- Resize(Width + 4, Height + 4, 2, 2);
- for y := 0 to Height-1 do begin
- p := Scanline[y];
- for x := 0 to Width-1 do begin
- FillByte(cSum, SizeOf(cSum), 0);
- cnt := 0;
- tmp := p;
- tsFormatUnmap(Format, tmp, c);
- if (c.a = 0) then begin
-
- // row - 1
- if (y > 0) then begin
-
- // row - 1 | col
- GetPixelAt(x, y-1, cTmp);
- AddCol(cTmp);
-
- //row - 1 | col - 1
- if (x > 0) then begin
- GetPixelAt(x-1, y-1, cTmp);
- AddCol(cTmp);
- end;
-
- // row - 1 | col + 1
- if (x < Width-1) then begin
- GetPixelAt(x+1, y-1, cTmp);
- AddCol(cTmp);
- end;
- end;
-
- // row + 1
- if (y < Height-1) then begin
- // row - 1 | col
- GetPixelAt(x, y+1, cTmp);
- AddCol(cTmp);
-
- //row + 1 | col - 1
- if (x > 0) then begin
- GetPixelAt(x-1, y+1, cTmp);
- AddCol(cTmp);
- end;
-
- // row + 1 | col + 1
- if (x < Width-1) then begin
- GetPixelAt(x+1, y+1, cTmp);
- AddCol(cTmp);
- end;
- end;
-
- //row | col - 1
- if (x > 0) then begin
- GetPixelAt(x-1, y+1, cTmp);
- AddCol(cTmp);
- end;
-
- // row | col + 1
- if (x < Width-1) then begin
- GetPixelAt(x+1, y+1, cTmp);
- AddCol(cTmp);
- end;
-
- // any pixel next to the transparent pixel they are opaque?
- if (cnt > 0) then begin
- for i := 0 to 2 do
- c.arr[i] := cSum.arr[i] / cnt;
- end;
- end;
- tsFormatMap(Format, p, c);
- end;
- end;
-end;
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
constructor TtsImage.Create;
begin
@@ -1061,7 +966,11 @@ end;
constructor TtsChar.Create(const aCharCode: WideChar);
begin
inherited Create;
- fCharCode := aCharCode;
+ fCharCode := aCharCode;
+ fGlyphOrigin := tsPosition(0, 0);
+ fGlyphRect := tsRect(0, 0, 0, 0);
+ fAdvance := 0;
+ fRenderRef := nil;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1077,13 +986,10 @@ function TtsFont.GetChar(const aCharCode: WideChar): TtsChar;
var
Chars: PtsFontCharArray;
begin
- if (Ord(aCharCode) > 0) then begin
- Chars := fChars[(Ord(aCharCode) shr 8) and $FF];
- if Assigned(Chars) then
- result := Chars^.Chars[Ord(aCharCode) and $FF]
- else
- result := nil;
- end else
+ Chars := fChars[(Ord(aCharCode) shr 8) and $FF];
+ if Assigned(Chars) then
+ result := Chars^.Chars[Ord(aCharCode) and $FF]
+ else
result := nil;
end;
@@ -1134,7 +1040,7 @@ end;
function TtsFont.AddChar(const aCharCode: WideChar): TtsChar;
begin
result := GetChar(aCharCode);
- if not Assigned(result) and fCreateChars and (Ord(aCharCode) > 0) then begin
+ if not Assigned(result) and fCreateChars then begin
result := fGenerator.GenerateChar(aCharCode, self, fRenderer);
if Assigned(result) then
AddChar(aCharCode, result);
@@ -1487,18 +1393,18 @@ var
CharImage: TtsImage;
begin
result := nil;
- if (Ord(aCharCode) = 0) or
- not GetGlyphMetrics(aFont, aCharCode, GlyphOrigin, GlyphSize, Advance) or
+ if not GetGlyphMetrics(aFont, aCharCode, GlyphOrigin, GlyphSize, Advance) or
not ((GlyphOrigin.x <> 0) or (GlyphOrigin.y <> 0) or (GlyphSize.x <> 0) or (GlyphSize.y <> 0) or (Advance <> 0)) then
exit;
CharImage := TtsImage.Create;
try
if aRenderer.SaveImages then begin
- if (GlyphSize.x > 0) and (GlyphSize.y > 0) then begin
+ if (GlyphSize.x > 0) and (GlyphSize.y > 0) then
GetCharImage(aFont, aCharCode, CharImage);
- end else if ([tsStyleUnderline, tsStyleStrikeout] * aFont.Properties.Style <> []) then begin
- CharImage.CreateEmpty(aRenderer.Format, Advance, 1);
+
+ if CharImage.IsEmpty and ([tsStyleUnderline, tsStyleStrikeout] * aFont.Properties.Style <> []) then begin
+ CharImage.CreateEmpty(aRenderer.Format, max(Advance, 1), 1);
GlyphOrigin.y := 1;
end;
end;