Explorar el Código

* fixed bug: spaces without underline/strikeout when created with GDI

master
Bergmann89 hace 9 años
padre
commit
06e3af7e47
Se han modificado 5 ficheros con 125 adiciones y 235 borrados
  1. +1
    -0
      examples/simple/TextSuiteTest.lpi
  2. +101
    -99
      examples/simple/TextSuiteTest.lps
  3. +4
    -5
      examples/simple/uMainForm.pas
  4. +4
    -22
      utsRendererOpenGL.pas
  5. +15
    -109
      utsTextSuite.pas

+ 1
- 0
examples/simple/TextSuiteTest.lpi Ver fichero

@@ -49,6 +49,7 @@
<Unit2> <Unit2>
<Filename Value="..\..\utsRendererOpenGL.pas"/> <Filename Value="..\..\utsRendererOpenGL.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="utsRendererOpenGL"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
<Filename Value="..\..\utsTextSuite.pas"/> <Filename Value="..\..\utsTextSuite.pas"/>


+ 101
- 99
examples/simple/TextSuiteTest.lps Ver fichero

@@ -10,7 +10,7 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<CursorPos X="29" Y="20"/> <CursorPos X="29" Y="20"/>
<UsageCount Value="138"/>
<UsageCount Value="141"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="uMainForm.pas"/> <Filename Value="uMainForm.pas"/>
@@ -19,35 +19,38 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="uMainForm"/> <UnitName Value="uMainForm"/>
<TopLine Value="42"/>
<CursorPos X="26" Y="59"/>
<UsageCount Value="138"/>
<IsVisibleTab Value="True"/>
<TopLine Value="140"/>
<CursorPos X="7" Y="156"/>
<UsageCount Value="141"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
<Filename Value="..\..\utsRendererOpenGL.pas"/> <Filename Value="..\..\utsRendererOpenGL.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<TopLine Value="494"/>
<CursorPos Y="522"/>
<UsageCount Value="66"/>
<UnitName Value="utsRendererOpenGL"/>
<EditorIndex Value="4"/>
<TopLine Value="448"/>
<CursorPos X="38" Y="467"/>
<UsageCount Value="69"/>
<Loaded Value="True"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
<Filename Value="..\..\utsTextSuite.pas"/> <Filename Value="..\..\utsTextSuite.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="utsTextSuite"/> <UnitName Value="utsTextSuite"/>
<EditorIndex Value="3"/> <EditorIndex Value="3"/>
<TopLine Value="1392"/>
<CursorPos Y="1405"/>
<UsageCount Value="66"/>
<TopLine Value="957"/>
<CursorPos Y="973"/>
<UsageCount Value="69"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
<Filename Value="..\..\utsTtfUtils.pas"/> <Filename Value="..\..\utsTtfUtils.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<UsageCount Value="66"/>
<UsageCount Value="69"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
<Filename Value="..\..\utsTypes.pas"/> <Filename Value="..\..\utsTypes.pas"/>
@@ -56,7 +59,7 @@
<EditorIndex Value="2"/> <EditorIndex Value="2"/>
<TopLine Value="93"/> <TopLine Value="93"/>
<CursorPos X="5" Y="109"/> <CursorPos X="5" Y="109"/>
<UsageCount Value="66"/>
<UsageCount Value="69"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit5> </Unit5>
<Unit6> <Unit6>
@@ -65,7 +68,7 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="174"/> <TopLine Value="174"/>
<CursorPos X="26" Y="194"/> <CursorPos X="26" Y="194"/>
<UsageCount Value="66"/>
<UsageCount Value="69"/>
</Unit6> </Unit6>
<Unit7> <Unit7>
<Filename Value="..\..\utsFontCreatorGDI.pas"/> <Filename Value="..\..\utsFontCreatorGDI.pas"/>
@@ -73,9 +76,9 @@
<UnitName Value="utsFontCreatorGDI"/> <UnitName Value="utsFontCreatorGDI"/>
<IsVisibleTab Value="True"/> <IsVisibleTab Value="True"/>
<WindowIndex Value="1"/> <WindowIndex Value="1"/>
<TopLine Value="433"/>
<CursorPos Y="453"/>
<UsageCount Value="66"/>
<TopLine Value="517"/>
<CursorPos Y="526"/>
<UsageCount Value="69"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit7> </Unit7>
<Unit8> <Unit8>
@@ -84,7 +87,7 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="315"/> <TopLine Value="315"/>
<CursorPos X="21" Y="325"/> <CursorPos X="21" Y="325"/>
<UsageCount Value="63"/>
<UsageCount Value="66"/>
</Unit8> </Unit8>
<Unit9> <Unit9>
<Filename Value="..\..\utsPostProcess.pas"/> <Filename Value="..\..\utsPostProcess.pas"/>
@@ -92,17 +95,16 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="216"/> <TopLine Value="216"/>
<CursorPos X="30" Y="227"/> <CursorPos X="30" Y="227"/>
<UsageCount Value="61"/>
<UsageCount Value="64"/>
</Unit9> </Unit9>
<Unit10> <Unit10>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/> <Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="utsFontCreatorFreeType"/> <UnitName Value="utsFontCreatorFreeType"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<TopLine Value="259"/>
<TopLine Value="237"/>
<CursorPos X="51" Y="339"/> <CursorPos X="51" Y="339"/>
<UsageCount Value="50"/>
<UsageCount Value="53"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit10> </Unit10>
<Unit11> <Unit11>
@@ -113,7 +115,7 @@
<WindowIndex Value="1"/> <WindowIndex Value="1"/>
<TopLine Value="284"/> <TopLine Value="284"/>
<CursorPos X="12" Y="298"/> <CursorPos X="12" Y="298"/>
<UsageCount Value="42"/>
<UsageCount Value="45"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit11> </Unit11>
<Unit12> <Unit12>
@@ -124,7 +126,7 @@
<WindowIndex Value="1"/> <WindowIndex Value="1"/>
<TopLine Value="292"/> <TopLine Value="292"/>
<CursorPos X="31" Y="308"/> <CursorPos X="31" Y="308"/>
<UsageCount Value="42"/>
<UsageCount Value="45"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit12> </Unit12>
<Unit13> <Unit13>
@@ -253,26 +255,26 @@
</Unit28> </Unit28>
<Unit29> <Unit29>
<Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\inc\ustringh.inc"/> <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\inc\ustringh.inc"/>
<EditorIndex Value="5"/>
<EditorIndex Value="6"/>
<TopLine Value="113"/> <TopLine Value="113"/>
<CursorPos X="10" Y="129"/> <CursorPos X="10" Y="129"/>
<UsageCount Value="37"/>
<UsageCount Value="38"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit29> </Unit29>
<Unit30> <Unit30>
<Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\inc\ustrings.inc"/> <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\inc\ustrings.inc"/>
<EditorIndex Value="6"/>
<EditorIndex Value="7"/>
<TopLine Value="2091"/> <TopLine Value="2091"/>
<CursorPos X="5" Y="2098"/> <CursorPos X="5" Y="2098"/>
<UsageCount Value="20"/>
<UsageCount Value="21"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit30> </Unit30>
<Unit31> <Unit31>
<Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\inc\systemh.inc"/> <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\inc\systemh.inc"/>
<EditorIndex Value="7"/>
<EditorIndex Value="8"/>
<TopLine Value="502"/> <TopLine Value="502"/>
<CursorPos X="3" Y="518"/> <CursorPos X="3" Y="518"/>
<UsageCount Value="35"/>
<UsageCount Value="36"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit31> </Unit31>
<Unit32> <Unit32>
@@ -319,18 +321,18 @@
<Unit38> <Unit38>
<Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\inc\dynlibs.pas"/> <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\inc\dynlibs.pas"/>
<UnitName Value="dynlibs"/> <UnitName Value="dynlibs"/>
<EditorIndex Value="8"/>
<EditorIndex Value="9"/>
<TopLine Value="143"/> <TopLine Value="143"/>
<CursorPos X="3" Y="149"/> <CursorPos X="3" Y="149"/>
<UsageCount Value="29"/>
<UsageCount Value="30"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit38> </Unit38>
<Unit39> <Unit39>
<Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\win\dynlibs.inc"/> <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\win\dynlibs.inc"/>
<EditorIndex Value="9"/>
<EditorIndex Value="10"/>
<TopLine Value="26"/> <TopLine Value="26"/>
<CursorPos X="10" Y="42"/> <CursorPos X="10" Y="42"/>
<UsageCount Value="27"/>
<UsageCount Value="28"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit39> </Unit39>
<Unit40> <Unit40>
@@ -372,8 +374,8 @@
</Unit44> </Unit44>
<Unit45> <Unit45>
<Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\inc\objpas.inc"/> <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\inc\objpas.inc"/>
<EditorIndex Value="4"/>
<UsageCount Value="28"/>
<EditorIndex Value="5"/>
<UsageCount Value="29"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit45> </Unit45>
<Unit46> <Unit46>
@@ -438,7 +440,7 @@
<WindowIndex Value="1"/> <WindowIndex Value="1"/>
<TopLine Value="2705"/> <TopLine Value="2705"/>
<CursorPos X="3" Y="2698"/> <CursorPos X="3" Y="2698"/>
<UsageCount Value="17"/>
<UsageCount Value="18"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit53> </Unit53>
<Unit54> <Unit54>
@@ -504,133 +506,133 @@
</Unit62> </Unit62>
<Unit63> <Unit63>
<Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\win\wininc\unifun.inc"/> <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\win\wininc\unifun.inc"/>
<EditorIndex Value="10"/>
<EditorIndex Value="11"/>
<TopLine Value="53"/> <TopLine Value="53"/>
<CursorPos X="22" Y="69"/> <CursorPos X="22" Y="69"/>
<UsageCount Value="25"/>
<UsageCount Value="26"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit63> </Unit63>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="338" TopLine="321"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1418" Column="11" TopLine="1394"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="339" TopLine="321"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1424" Column="36" TopLine="1400"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="341" TopLine="321"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1411" TopLine="1400"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="342" TopLine="321"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1414" TopLine="1400"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="343" TopLine="321"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1418" TopLine="1400"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="344" TopLine="321"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1419" TopLine="1400"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="347" TopLine="321"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1420" TopLine="1400"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="348" TopLine="322"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1421" TopLine="1400"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="344" Column="24" TopLine="323"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1422" TopLine="1400"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="338" TopLine="323"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1423" TopLine="1400"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="339" TopLine="323"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1424" TopLine="1400"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="338" TopLine="323"/>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<Caret Line="277" Column="47" TopLine="258"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="339" TopLine="323"/>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<Caret Line="268" TopLine="258"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="..\..\utsFreeType.pas"/>
<Caret Line="45" Column="17" TopLine="30"/>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<Caret Line="269" TopLine="258"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="349" Column="30" TopLine="331"/>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<Caret Line="270" TopLine="258"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="351" Column="35" TopLine="331"/>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<Caret Line="271" TopLine="258"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="343" Column="17" TopLine="331"/>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<Caret Line="272" TopLine="258"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="348" TopLine="332"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1413" Column="32" TopLine="1400"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="341" Column="28" TopLine="332"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="2000" Column="3" TopLine="1996"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="348" TopLine="332"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="2060" Column="30" TopLine="2037"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="349" TopLine="332"/>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<Caret Line="270" Column="33" TopLine="258"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="341" Column="30" TopLine="332"/>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<Caret Line="277" Column="62" TopLine="258"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="..\..\utsFontCreatorGDI.pas"/>
<Caret Line="446" TopLine="433"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1429" Column="38" TopLine="1408"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="..\..\utsFontCreatorGDI.pas"/>
<Caret Line="447" TopLine="433"/>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<Caret Line="277" TopLine="258"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="..\..\utsFontCreatorGDI.pas"/>
<Caret Line="448" TopLine="433"/>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<Caret Line="272" Column="52" TopLine="258"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="..\..\utsFontCreatorGDI.pas"/>
<Caret Line="449" TopLine="433"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1424" Column="7" TopLine="1408"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="..\..\utsFontCreatorGDI.pas"/>
<Caret Line="446" TopLine="433"/>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="110" TopLine="99"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="348" TopLine="326"/>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<Caret Line="272" Column="51" TopLine="258"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="349" Column="5" TopLine="327"/>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<Caret Line="444" Column="29" TopLine="429"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="uMainForm.pas"/>
<Caret Line="90" Column="92" TopLine="60"/>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<Caret Line="448" Column="3" TopLine="441"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectSession> </ProjectSession>


+ 4
- 5
examples/simple/uMainForm.pas Ver fichero

@@ -51,7 +51,6 @@ uses


const 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 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); procedure TMainForm.FormCreate(Sender: TObject);
var var
@@ -85,9 +84,9 @@ begin
ftsGenerator.AddPostProcessStep(pp); ftsGenerator.AddPostProcessStep(pp);
} }
try 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); 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 except
on e: EtsException do on e: EtsException do
MessageDlg('Error', e.Message, mtError, [mbOK], 0); MessageDlg('Error', e.Message, mtError, [mbOK], 0);
@@ -157,8 +156,8 @@ begin
//block.HorzAlign := tsHorzAlignJustify; //block.HorzAlign := tsHorzAlignJustify;


block.ChangeFont(ftsFont1); 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.ChangeFont(ftsFont3);
block.ChangeColor(tsColor4f(1.0, 1.0, 1.0, 1.0)); block.ChangeColor(tsColor4f(1.0, 1.0, 1.0, 1.0));


+ 4
- 22
utsRendererOpenGL.pas Ver fichero

@@ -266,16 +266,16 @@ var


// Text Coords // Text Coords
result.TextureID := aTexture^.ID; 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.x := aCharImage.Width / aTexture^.Size;
result.TexCoordSize.y := aCharImage.Height / aTexture^.Size; result.TexCoordSize.y := aCharImage.Height / aTexture^.Size;


// Vertex Coords // Vertex Coords
result.VertexPos.x := -aChar.GlyphRect.Left; result.VertexPos.x := -aChar.GlyphRect.Left;
result.VertexPos.y := -aChar.GlyphRect.Top - aChar.GlyphOrigin.y; 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); glBindTexture(GL_TEXTURE_2D, result.TextureID);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
@@ -444,24 +444,6 @@ end;
procedure TtsRendererOpenGL.Render(const aCharRef: TtsCharRenderRef); procedure TtsRendererOpenGL.Render(const aCharRef: TtsCharRenderRef);
var var
ref: TtsCharRenderRefOpenGL; 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 begin
if Assigned(aCharRef) and (aCharRef is TtsCharRenderRefOpenGL) then begin if Assigned(aCharRef) and (aCharRef is TtsCharRenderRefOpenGL) then begin
ref := (aCharRef as TtsCharRenderRefOpenGL); ref := (aCharRef as TtsCharRenderRefOpenGL);


+ 15
- 109
utsTextSuite.pas Ver fichero

@@ -95,8 +95,6 @@ type
procedure Blend(const aImage: TtsImage; const X, Y: Integer; const aFunc: TtsBlendFunc); procedure Blend(const aImage: TtsImage; const X, Y: Integer; const aFunc: TtsBlendFunc);
procedure Blur(const aHorzKernel, aVertKernel: TtsKernel1D; const aChannelMask: TtsColorChannels); procedure Blur(const aHorzKernel, aVertKernel: TtsKernel1D; const aChannelMask: TtsColorChannels);


procedure AddResizingBorder;

constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
end; end;
@@ -948,99 +946,6 @@ begin
end; end;
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; constructor TtsImage.Create;
begin begin
@@ -1061,7 +966,11 @@ end;
constructor TtsChar.Create(const aCharCode: WideChar); constructor TtsChar.Create(const aCharCode: WideChar);
begin begin
inherited Create; inherited Create;
fCharCode := aCharCode;
fCharCode := aCharCode;
fGlyphOrigin := tsPosition(0, 0);
fGlyphRect := tsRect(0, 0, 0, 0);
fAdvance := 0;
fRenderRef := nil;
end; end;


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1077,13 +986,10 @@ function TtsFont.GetChar(const aCharCode: WideChar): TtsChar;
var var
Chars: PtsFontCharArray; Chars: PtsFontCharArray;
begin 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; result := nil;
end; end;


@@ -1134,7 +1040,7 @@ end;
function TtsFont.AddChar(const aCharCode: WideChar): TtsChar; function TtsFont.AddChar(const aCharCode: WideChar): TtsChar;
begin begin
result := GetChar(aCharCode); 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); result := fGenerator.GenerateChar(aCharCode, self, fRenderer);
if Assigned(result) then if Assigned(result) then
AddChar(aCharCode, result); AddChar(aCharCode, result);
@@ -1487,18 +1393,18 @@ var
CharImage: TtsImage; CharImage: TtsImage;
begin begin
result := nil; 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 not ((GlyphOrigin.x <> 0) or (GlyphOrigin.y <> 0) or (GlyphSize.x <> 0) or (GlyphSize.y <> 0) or (Advance <> 0)) then
exit; exit;


CharImage := TtsImage.Create; CharImage := TtsImage.Create;
try try
if aRenderer.SaveImages then begin 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); 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; GlyphOrigin.y := 1;
end; end;
end; end;


Cargando…
Cancelar
Guardar