aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-10-28 18:57:02 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-10-28 18:57:02 +0000
commite8a388e32a4563ac9ea0895ca6c7cdf83cf9d3ec (patch)
tree832c59176b260af0a3e89f058699cec2b9a7dca0
parentc01eba6a6494bb583b5bf43bea404b918b5c9c63 (diff)
downloadusdx-e8a388e32a4563ac9ea0895ca6c7cdf83cf9d3ec.tar.gz
usdx-e8a388e32a4563ac9ea0895ca6c7cdf83cf9d3ec.tar.xz
usdx-e8a388e32a4563ac9ea0895ca6c7cdf83cf9d3ec.zip
- glPrint(Pchar) -> glPrint(string)
- glPrintLetter removed - font engine handles FT_PIXEL_MODE_MONO as FT_Glyph_To_Bitmap(FT_RENDER_MODE_NORMAL) might return a 1bit/pixel black/white image instead of 8bit/pixel gray shaded one (happened with 16px japanese glyphs of simsun.ttf, latin ones were correct). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1482 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--src/base/UDraw.pas4
-rw-r--r--src/base/UEditorLyrics.pas4
-rw-r--r--src/base/UFont.pas28
-rw-r--r--src/base/ULyrics.pas11
-rw-r--r--src/base/USingScores.pas6
-rw-r--r--src/base/USong.pas10
-rw-r--r--src/lib/freetype/freetype.pas141
-rw-r--r--src/menu/UDisplay.pas6
-rw-r--r--src/menu/UMenuSelectSlide.pas6
-rw-r--r--src/menu/UMenuText.pas16
-rw-r--r--src/screens/UScreenCredits.pas63
-rw-r--r--src/screens/UScreenEditConvert.pas2
-rw-r--r--src/screens/UScreenOptionsRecord.pas4
-rw-r--r--src/screens/UScreenSing.pas33
-rw-r--r--src/screens/UScreenSingModi.pas2
15 files changed, 182 insertions, 154 deletions
diff --git a/src/base/UDraw.pas b/src/base/UDraw.pas
index 61335a53..a92d67d4 100644
--- a/src/base/UDraw.pas
+++ b/src/base/UDraw.pas
@@ -1226,7 +1226,7 @@ if Age < 5 then SetFontSize((Age + 1) * 3) else SetFontSize(18);
SetFontItalic(False);
//Check Font Size
-Length := glTextWidth ( PChar(Text)) + 3; //Little Space for a Better Look ^^
+Length := glTextWidth (Text) + 3; //Little Space for a Better Look ^^
//Text
SetFontPos (X + 50 - (Length / 2), Y + 12); //Position
@@ -1256,7 +1256,7 @@ if Age < 5 then Size := Age * 10 else Size := 50;
glColor4f(1, 1, 1, Alpha); //Set Color
//Draw Text
- glPrint (PChar(Text));
+ glPrint (Text);
end;
end;
//PhrasenBonus - Line Bonus Mod}
diff --git a/src/base/UEditorLyrics.pas b/src/base/UEditorLyrics.pas
index e307ba2d..3c4ddb24 100644
--- a/src/base/UEditorLyrics.pas
+++ b/src/base/UEditorLyrics.pas
@@ -192,7 +192,7 @@ begin
Word[WordNum].FontStyle := FontStyleI;
SetFontStyle(FontStyleI);
SetFontSize(SizeR);
- Word[WordNum].Width := glTextWidth(pchar(Text));
+ Word[WordNum].Width := glTextWidth(Text);
Word[WordNum].Text := Text;
Word[WordNum].ColR := ColR;
Word[WordNum].ColG := ColG;
@@ -247,7 +247,7 @@ begin
SetFontSize(Word[W].Size);
SetFontItalic(Word[W].Italic);
glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB);
- glPrint(pchar(Word[W].Text));
+ glPrint(Word[W].Text);
end;
end;
diff --git a/src/base/UFont.pas b/src/base/UFont.pas
index 30be4c3b..a72bca21 100644
--- a/src/base/UFont.pas
+++ b/src/base/UFont.pas
@@ -2019,8 +2019,8 @@ var
Glyph: FT_Glyph;
BitmapGlyph: FT_BitmapGlyph;
Bitmap: PFT_Bitmap;
- BitmapLine: PChar;
- BitmapBuffer: PChar;
+ BitmapLine: PByteArray;
+ BitmapBuffer: PByteArray;
TexBuffer: TGLubyteDynArray;
TexLine: PGLubyteArray;
CBox: FT_BBox;
@@ -2045,8 +2045,9 @@ begin
fBounds.Bottom := CBox.yMin / 64;
fBounds.Top := CBox.yMax / 64 + fOutset*2;
- // convert the glyph to a bitmap (and destroy original glyph image)
- FT_Glyph_To_Bitmap(Glyph, ft_render_mode_normal, nil, 1);
+ // convert the glyph to a bitmap (and destroy original glyph image).
+ // Request 8 bit gray level pixel mode.
+ FT_Glyph_To_Bitmap(Glyph, FT_RENDER_MODE_NORMAL, nil, 1);
BitmapGlyph := FT_BitmapGlyph(Glyph);
// get bitmap offsets
@@ -2094,8 +2095,23 @@ begin
// get next lower line offset, use pitch instead of width as it tells
// us the storage direction of the lines. In addition a line might be padded.
BitmapLine := @BitmapBuffer[Y * Bitmap.pitch];
- for X := 0 to Bitmap.width-1 do
- TexLine[X] := GLubyte(BitmapLine[X]);
+
+ // check for pixel mode and copy pixels
+ // Should be 8 bit gray, but even with FT_RENDER_MODE_NORMAL, freetype
+ // sometimes (e.g. 16px sized japanese fonts) fallbacks to 1 bit pixels.
+ case (Bitmap.pixel_mode) of
+ FT_PIXEL_MODE_GRAY: begin // 8 bit gray
+ for X := 0 to Bitmap.width-1 do
+ TexLine[X] := BitmapLine[X];
+ end;
+ FT_PIXEL_MODE_MONO: begin // 1 bit mono
+ for X := 0 to Bitmap.width-1 do
+ TexLine[X] := High(GLubyte) * ((BitmapLine[X div 8] shr (7-(X mod 8))) and $1);
+ end;
+ else begin
+ // unhandled pixel format
+ end;
+ end;
end;
if (fOutset > 0) then
diff --git a/src/base/ULyrics.pas b/src/base/ULyrics.pas
index 5c5449b1..82982981 100644
--- a/src/base/ULyrics.pas
+++ b/src/base/ULyrics.pas
@@ -428,7 +428,7 @@ begin
CurWord := @LyricLine.Words[I];
SetFontItalic(CurWord.Freestyle);
SetFontPos(PosX, Y);
- glPrint(PChar(CurWord.Text));
+ glPrint(CurWord.Text);
PosX := PosX + CurWord.Width;
end;
end;
@@ -464,7 +464,7 @@ begin
// set font size to a reasonable value
LyricLine.Height := RequestHeight * 0.9;
SetFontSize(LyricLine.Height);
- LyricLine.Width := glTextWidth(PChar(LyricLine.Text));
+ LyricLine.Width := glTextWidth(LyricLine.Text);
// change font-size to fit into the lyric bar
if (LyricLine.Width > RequestWidth) then
@@ -475,7 +475,7 @@ begin
LyricLine.Height := 1;
SetFontSize(LyricLine.Height);
- LyricLine.Width := glTextWidth(PChar(LyricLine.Text));
+ LyricLine.Width := glTextWidth(LyricLine.Text);
end;
// calc word positions and widths
@@ -496,7 +496,7 @@ begin
end;
CurWord.X := PosX;
- CurWord.Width := glTextWidth(PChar(CurWord.Text));
+ CurWord.Width := glTextWidth(CurWord.Text);
PosX := PosX + CurWord.Width;
SetFontItalic(false);
end;
@@ -540,7 +540,6 @@ begin
SetFontStyle(FontStyle);
ResetFont();
SetFontSize(Line.Height);
- glColor4f(1, 1, 1, 1);
// center lyrics
LyricX := X + (W - Line.Width) / 2;
@@ -670,8 +669,6 @@ begin
// draw the ball onto the current word
if (LyricsEffect = lfxBall) then
begin
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
DrawBall(LyricX + CurWord.X + CurWord.Width * Progress,
LyricY - 15 - 15*sin(Progress * Pi), Alpha);
end;
diff --git a/src/base/USingScores.pas b/src/base/USingScores.pas
index 8e2455e1..2d9b1e5e 100644
--- a/src/base/USingScores.pas
+++ b/src/base/USingScores.pas
@@ -817,14 +817,14 @@ begin
SetFontSize(FontSize);
//Draw Text
- TextLen := glTextWidth(PChar(Theme.Sing.LineBonusText[PopUp.Rating]));
+ TextLen := glTextWidth(Theme.Sing.LineBonusText[PopUp.Rating]);
//Color and Pos
SetFontPos (X + (W - TextLen) / 2, Y + FontOffset);
glColor4f(1, 1, 1, Alpha);
//Draw
- glPrint(PChar(Theme.Sing.LineBonusText[PopUp.Rating]));
+ glPrint(Theme.Sing.LineBonusText[PopUp.Rating]);
end; //eo Alpha check
end; //eo Right Screen
end; //eo Player has Position
@@ -877,7 +877,7 @@ begin
While (Length(ScoreStr) < 5) do
ScoreStr := '0' + ScoreStr;
- glPrint(PChar(ScoreStr));
+ glPrint(ScoreStr);
end; //eo Right Screen
end; //eo Player has Position
diff --git a/src/base/USong.pas b/src/base/USong.pas
index 6c81cecc..4793b7e9 100644
--- a/src/base/USong.pas
+++ b/src/base/USong.pas
@@ -326,7 +326,7 @@ begin
if not Both then
begin
Lines[CP].Line[Lines[CP].High].BaseNote := Base[CP];
- Lines[CP].Line[Lines[CP].High].LyricWidth := glTextWidth(PChar(Lines[CP].Line[Lines[CP].High].Lyric));
+ Lines[CP].Line[Lines[CP].High].LyricWidth := glTextWidth(Lines[CP].Line[Lines[CP].High].Lyric);
//Total Notes Patch
Lines[CP].Line[Lines[CP].High].TotalNotes := 0;
for I := low(Lines[CP].Line[Lines[CP].High].Note) to high(Lines[CP].Line[Lines[CP].High].Note) do
@@ -344,7 +344,7 @@ begin
for Count := 0 to High(Lines) do
begin
Lines[Count].Line[Lines[Count].High].BaseNote := Base[Count];
- Lines[Count].Line[Lines[Count].High].LyricWidth := glTextWidth(PChar(Lines[Count].Line[Lines[Count].High].Lyric));
+ Lines[Count].Line[Lines[Count].High].LyricWidth := glTextWidth(Lines[Count].Line[Lines[Count].High].Lyric);
//Total Notes Patch
Lines[Count].Line[Lines[Count].High].TotalNotes := 0;
for I := low(Lines[Count].Line[Lines[Count].High].Note) to high(Lines[Count].Line[Lines[Count].High].Note) do
@@ -500,7 +500,7 @@ begin
if not Both then
begin
Lines[CP].Line[Lines[CP].High].BaseNote := Base[CP];
- Lines[CP].Line[Lines[CP].High].LyricWidth := glTextWidth(PChar(Lines[CP].Line[Lines[CP].High].Lyric));
+ Lines[CP].Line[Lines[CP].High].LyricWidth := glTextWidth(Lines[CP].Line[Lines[CP].High].Lyric);
//Total Notes Patch
Lines[CP].Line[Lines[CP].High].TotalNotes := 0;
for NoteIndex := 0 to high(Lines[CP].Line[Lines[CP].High].Note) do
@@ -518,7 +518,7 @@ begin
for Count := 0 to High(Lines) do
begin
Lines[Count].Line[Lines[Count].High].BaseNote := Base[Count];
- Lines[Count].Line[Lines[Count].High].LyricWidth := glTextWidth(PChar(Lines[Count].Line[Lines[Count].High].Lyric));
+ Lines[Count].Line[Lines[Count].High].LyricWidth := glTextWidth(Lines[Count].Line[Lines[Count].High].Lyric);
//Total Notes Patch
Lines[Count].Line[Lines[Count].High].TotalNotes := 0;
for NoteIndex := 0 to high(Lines[Count].Line[Lines[Count].High].Note) do
@@ -987,7 +987,7 @@ begin
begin //Update old Sentence if it has notes and create a new sentence
// stara czesc //Alter Satz //Update Old Part
Lines[LineNumberP].Line[Lines[LineNumberP].High].BaseNote := Base[LineNumberP];
- Lines[LineNumberP].Line[Lines[LineNumberP].High].LyricWidth := glTextWidth(PChar(Lines[LineNumberP].Line[Lines[LineNumberP].High].Lyric));
+ Lines[LineNumberP].Line[Lines[LineNumberP].High].LyricWidth := glTextWidth(Lines[LineNumberP].Line[Lines[LineNumberP].High].Lyric);
//Total Notes Patch
Lines[LineNumberP].Line[Lines[LineNumberP].High].TotalNotes := 0;
diff --git a/src/lib/freetype/freetype.pas b/src/lib/freetype/freetype.pas
index 65cce749..5263bd92 100644
--- a/src/lib/freetype/freetype.pas
+++ b/src/lib/freetype/freetype.pas
@@ -68,6 +68,11 @@ type
PFT_Short = ^FT_Short;
PFT_String = ^FT_String;
+
+ TByteArray = array [0 .. (MaxInt div SizeOf(byte))-1] of byte;
+ PByteArray = ^TByteArray;
+
+
(*************************************************************************)
(* *)
(* <Enum> *)
@@ -563,6 +568,74 @@ const
(* *)
type
FT_Render_Mode = FT_Int;
+const
+ FT_RENDER_MODE_NORMAL = 0;
+ FT_RENDER_MODE_LIGHT = FT_RENDER_MODE_NORMAL + 1;
+ FT_RENDER_MODE_MONO = FT_RENDER_MODE_LIGHT + 1;
+ FT_RENDER_MODE_LCD = FT_RENDER_MODE_MONO + 1;
+ FT_RENDER_MODE_LCD_V = FT_RENDER_MODE_LCD + 1;
+ FT_RENDER_MODE_MAX = FT_RENDER_MODE_LCD_V + 1;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Enum> *)
+ (* FT_Pixel_Mode *)
+ (* *)
+ (* <Description> *)
+ (* An enumeration type used to describe the format of pixels in a *)
+ (* given bitmap. Note that additional formats may be added in the *)
+ (* future. *)
+ (* *)
+ (* <Values> *)
+ (* FT_PIXEL_MODE_NONE :: *)
+ (* Value 0 is reserved. *)
+ (* *)
+ (* FT_PIXEL_MODE_MONO :: *)
+ (* A monochrome bitmap, using 1 bit per pixel. Note that pixels *)
+ (* are stored in most-significant order (MSB), which means that *)
+ (* the left-most pixel in a byte has value 128. *)
+ (* *)
+ (* FT_PIXEL_MODE_GRAY :: *)
+ (* An 8-bit bitmap, generally used to represent anti-aliased glyph *)
+ (* images. Each pixel is stored in one byte. Note that the number *)
+ (* of value `gray' levels is stored in the `num_bytes' field of *)
+ (* the @FT_Bitmap structure (it generally is 256). *)
+ (* *)
+ (* FT_PIXEL_MODE_GRAY2 :: *)
+ (* A 2-bit/pixel bitmap, used to represent embedded anti-aliased *)
+ (* bitmaps in font files according to the OpenType specification. *)
+ (* We haven't found a single font using this format, however. *)
+ (* *)
+ (* FT_PIXEL_MODE_GRAY4 :: *)
+ (* A 4-bit/pixel bitmap, used to represent embedded anti-aliased *)
+ (* bitmaps in font files according to the OpenType specification. *)
+ (* We haven't found a single font using this format, however. *)
+ (* *)
+ (* FT_PIXEL_MODE_LCD :: *)
+ (* An 8-bit bitmap, used to represent RGB or BGR decimated glyph *)
+ (* images used for display on LCD displays; the bitmap is three *)
+ (* times wider than the original glyph image. See also *)
+ (* @FT_RENDER_MODE_LCD. *)
+ (* *)
+ (* FT_PIXEL_MODE_LCD_V :: *)
+ (* An 8-bit bitmap, used to represent RGB or BGR decimated glyph *)
+ (* images used for display on rotated LCD displays; the bitmap *)
+ (* is three times taller than the original glyph image. See also *)
+ (* @FT_RENDER_MODE_LCD_V. *)
+ (* *)
+type
+ FT_Pixel_Mode = byte;
+const
+ FT_PIXEL_MODE_NONE = 0;
+ FT_PIXEL_MODE_MONO = FT_PIXEL_MODE_NONE + 1;
+ FT_PIXEL_MODE_GRAY = FT_PIXEL_MODE_MONO + 1;
+ FT_PIXEL_MODE_GRAY2 = FT_PIXEL_MODE_GRAY + 1;
+ FT_PIXEL_MODE_GRAY4 = FT_PIXEL_MODE_GRAY2 + 1;
+ FT_PIXEL_MODE_LCD = FT_PIXEL_MODE_GRAY4 + 1;
+ FT_PIXEL_MODE_LCD_V = FT_PIXEL_MODE_LCD + 1;
+
+ FT_PIXEL_MODE_MAX = FT_PIXEL_MODE_LCD_V + 1; (* do not remove *)
(*************************************************************************)
@@ -601,6 +674,7 @@ type
(* vertAdvance :: *)
(* Advance height for vertical layout. *)
(* *)
+type
FT_Glyph_Metrics = record
width ,
height : FT_Pos;
@@ -809,10 +883,10 @@ type
rows ,
width : FT_Int;
pitch : FT_Int;
- buffer : PChar;
+ buffer : PByteArray;
num_grays : FT_Short;
pixel_mode ,
- palette_mode : char;
+ palette_mode : byte;
palette : pointer;
end;
@@ -1719,7 +1793,7 @@ type
(* @macro: *)
(* FT_CURVE_TAG ( flag ) *)
(* *)
- function FT_CURVE_TAG (flag : char ) : char;
+ function FT_CURVE_TAG(flag: byte): byte;
const
FT_CURVE_TAG_ON = 1;
@@ -2027,63 +2101,6 @@ const
load_flags : FT_Int32 ) : FT_Error;
cdecl; external ft_lib name 'FT_Load_Glyph';
- (*************************************************************************)
- (* *)
- (* <Enum> *)
- (* FT_Render_Mode *)
- (* *)
- (* <Description> *)
- (* An enumeration type that lists the render modes supported by *)
- (* FreeType 2. Each mode corresponds to a specific type of scanline *)
- (* conversion performed on the outline, as well as specific *)
- (* hinting optimizations. *)
- (* *)
- (* For bitmap fonts the `bitmap->pixel_mode' field in the *)
- (* @FT_GlyphSlotRec structure gives the format of the returned *)
- (* bitmap. *)
- (* *)
- (* <Values> *)
- (* FT_RENDER_MODE_NORMAL :: *)
- (* This is the default render mode; it corresponds to 8-bit *)
- (* anti-aliased bitmaps, using 256 levels of opacity. *)
- (* *)
- (* FT_RENDER_MODE_LIGHT :: *)
- (* This is similar to @FT_RENDER_MODE_NORMAL -- you have to use *)
- (* @FT_LOAD_TARGET_LIGHT in calls to @FT_Load_Glyph to get any *)
- (* effect since the rendering process no longer influences the *)
- (* positioning of glyph outlines. *)
- (* *)
- (* The resulting glyph shapes are more similar to the original, *)
- (* while being a bit more fuzzy (`better shapes' instead of `better *)
- (* contrast', so to say. *)
- (* *)
- (* FT_RENDER_MODE_MONO :: *)
- (* This mode corresponds to 1-bit bitmaps. *)
- (* *)
- (* FT_RENDER_MODE_LCD :: *)
- (* This mode corresponds to horizontal RGB/BGR sub-pixel displays, *)
- (* like LCD-screens. It produces 8-bit bitmaps that are 3 times *)
- (* the width of the original glyph outline in pixels, and which use *)
- (* the @FT_PIXEL_MODE_LCD mode. *)
- (* *)
- (* FT_RENDER_MODE_LCD_V :: *)
- (* This mode corresponds to vertical RGB/BGR sub-pixel displays *)
- (* (like PDA screens, rotated LCD displays, etc.). It produces *)
- (* 8-bit bitmaps that are 3 times the height of the original *)
- (* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. *)
- (* *)
- (* <Note> *)
- (* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph are *)
- (* _not filtered_ to reduce color-fringes. It is up to the caller to *)
- (* perform this pass. *)
- (* *)
-const
- FT_RENDER_MODE_NORMAL = 0;
- FT_RENDER_MODE_LIGHT = FT_RENDER_MODE_NORMAL + 1;
- FT_RENDER_MODE_MONO = FT_RENDER_MODE_LIGHT + 1;
- FT_RENDER_MODE_LCD = FT_RENDER_MODE_MONO + 1;
- FT_RENDER_MODE_LCD_V = FT_RENDER_MODE_LCD + 1;
- FT_RENDER_MODE_MAX = FT_RENDER_MODE_LCD_V + 1;
(*************************************************************************)
(* *)
@@ -2482,9 +2499,9 @@ implementation
{ FT_CURVE_TAG }
-function FT_CURVE_TAG(flag : char ) : char;
+function FT_CURVE_TAG(flag: byte): byte;
begin
- result := char(byte(flag) and 3);
+ result := flag and 3;
end;
{ FT_IS_SCALABLE }
diff --git a/src/menu/UDisplay.pas b/src/menu/UDisplay.pas
index bea9b58d..f4cca4a5 100644
--- a/src/menu/UDisplay.pas
+++ b/src/menu/UDisplay.pas
@@ -397,16 +397,16 @@ begin
//FPS
SetFontPos(695, 0);
- glPrint (PChar('FPS: ' + InttoStr(LastFPS)));
+ glPrint ('FPS: ' + InttoStr(LastFPS));
//RSpeed
SetFontPos(695, 13);
- glPrint (PChar('RSpeed: ' + InttoStr(Round(1000 * TimeMid))));
+ glPrint ('RSpeed: ' + InttoStr(Round(1000 * TimeMid)));
//LastError
SetFontPos(695, 26);
glColor4f(1, 0, 0, 1);
- glPrint (PChar(OSD_LastError));
+ glPrint (OSD_LastError);
glColor4f(1, 1, 1, 1);
end;
diff --git a/src/menu/UMenuSelectSlide.pas b/src/menu/UMenuSelectSlide.pas
index ed1db6cf..d04b20d0 100644
--- a/src/menu/UMenuSelectSlide.pas
+++ b/src/menu/UMenuSelectSlide.pas
@@ -333,8 +333,8 @@ begin
for I := low(TextOptT) to high (TextOptT) do
begin
- if (glTextWidth(PChar(TextOptT[I])) > maxlength) then
- maxlength := glTextWidth(PChar(TextOptT[I]));
+ if (glTextWidth(TextOptT[I]) > maxlength) then
+ maxlength := glTextWidth(TextOptT[I]);
end;
Lines := floor((TextureSBG.W-40) / (maxlength+7));
@@ -374,7 +374,7 @@ begin
//Better Look with 2 Options
if (Lines=2) AND (Length(TextOptT)= 2) then
- TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(PChar(TextOptT[1]))) * I;
+ TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(TextOptT[1])) * I;
end;
end;
diff --git a/src/menu/UMenuText.pas b/src/menu/UMenuText.pas
index 1a7c15a1..5c41eba5 100644
--- a/src/menu/UMenuText.pas
+++ b/src/menu/UMenuText.pas
@@ -200,7 +200,7 @@ begin
if isBreak then
begin
//Look for Break before the Break
- if (glTextWidth(PChar(Copy(Value, LastBreak, NextPos - LastBreak + 1))) > W) AND (NextPos-LastPos > 1) then
+ if (glTextWidth(Copy(Value, LastBreak, NextPos - LastBreak + 1)) > W) AND (NextPos-LastPos > 1) then
begin
isBreak := False;
//Not the First word after Break, so we don't have to break within a word
@@ -221,7 +221,7 @@ begin
AddBreak(LastBreak, NextPos);
end
//Text comes out of the Text Area -> CreateBreak
- else if (glTextWidth(PChar(Copy(Value, LastBreak, NextPos - LastBreak + 1))) > W) then
+ else if (glTextWidth(Copy(Value, LastBreak, NextPos - LastBreak + 1)) > W) then
begin
//Not the First word after Break, so we don't have to break within a word
if (FirstWord > 1) then
@@ -295,12 +295,12 @@ begin
case Align of
0: X2 := X;
- 1: X2 := X - glTextWidth(pchar(Text2))/2;
- 2: X2 := X - glTextWidth(pchar(Text2));
+ 1: X2 := X - glTextWidth(Text2)/2;
+ 2: X2 := X - glTextWidth(Text2);
end;
SetFontPos(X2, Y);
- glPrint(PChar(Text2));
+ glPrint(Text2);
SetFontStyle(0); // reset to default
end
else
@@ -317,15 +317,15 @@ begin
case Align of
0: X2 := X + MoveX;
- 1: X2 := X + MoveX - glTextWidth(pchar(Text2))/2;
- 2: X2 := X + MoveX - glTextWidth(pchar(Text2));
+ 1: X2 := X + MoveX - glTextWidth(Text2)/2;
+ 2: X2 := X + MoveX - glTextWidth(Text2);
end;
SetFontPos(X2, Y2);
SetFontZ(Z);
- glPrint(PChar(Text2));
+ glPrint(Text2);
{if Size >= 10 then
Y2 := Y2 + Size * 0.93
diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas
index fca65359..7e85c5d4 100644
--- a/src/screens/UScreenCredits.pas
+++ b/src/screens/UScreenCredits.pas
@@ -327,39 +327,56 @@ Procedure TScreenCredits.Draw_FunkyText;
var
S: Integer;
X,Y,A: Real;
- visibleText: PChar;
+ visibleText: string;
begin
SetFontSize(30);
+
//Init ScrollingText
if (CTime = Timings[7]) then
begin
//Set Position of Text
Credits_X := 600;
- CurrentScrollStart:=1;
- CurrentScrollEnd:=1;
+ CurrentScrollStart := 1;
+ CurrentScrollEnd := 1;
end;
- if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then
+ if (CTime > Timings[7]) and
+ (CurrentScrollStart < length(Funky_Text)) then
begin
- X:=0;
- visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd));
- for S := 0 to length(visibleText)-1 do begin
- Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi));
- SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000);
- A:=0;
- if (Credits_X+X < 15) then A:=0;
- if (Credits_X+X >=15) then A:=Credits_X+X-15;
- if Credits_X+X > 32 then A:=17;
- glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17);
- glPrintLetter(visibleText[S]);
- X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW;
+ X := 0;
+ visibleText := Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd);
+
+ for S := 1 to length(visibleText) do
+ begin
+ Y := abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi));
+ SetFontPos(Credits_X+X, 538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000);
+
+ if (Credits_X + X > 32) then
+ A := 17
+ else if (Credits_X + X >= 15) then
+ A := Credits_X + X - 15
+ else
+ A := 0;
+
+ glColor4f(230/255-40/255+Y*(Credits_X+X)/900,
+ 200/255-30/255+Y*(Credits_X+X)/1000,
+ 155/255-20/255+Y*(Credits_X+X)/1100,
+ A/17);
+ glPrint(visibleText[S]);
+ X := X + glTextWidth(visibleText[S]);
end;
- if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin
- Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW;
+
+ if (Credits_X < 0) and (CurrentScrollStart < length(Funky_Text)) then
+ begin
+ Credits_X := Credits_X + glTextWidth(Funky_Text[CurrentScrollStart]);
inc(CurrentScrollStart);
end;
- visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd));
- if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin
+
+ visibleText := Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd);
+
+ if (Credits_X + glTextWidth(visibleText) < 600) and
+ (CurrentScrollEnd < length(Funky_Text)) then
+ begin
inc(CurrentScrollEnd);
end;
end;
@@ -370,9 +387,9 @@ begin
SetFontSize(27);
glColor4f(1, 1, 1, 1);
for S:=0 to high(CTime_hold) do begin
- visibleText:=pchar(inttostr(CTime_hold[S]));
+ visibleText:=inttostr(CTime_hold[S]);
SetFontPos (500, X);
- glPrint (Addr(visibleText[0]));
+ glPrint (visibleText[0]);
X:=X+20;
end;
}
@@ -1357,7 +1374,7 @@ begin
glColor4f(1, 1, 1, 1);
//RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10);
RuntimeStr:='CTime: '+inttostr(CTime);
- glPrint (Addr(RuntimeStr[1]));
+ glPrint (RuntimeStr[1]);
}
// make the stars shine
diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas
index 9efa1a92..8de2efe4 100644
--- a/src/screens/UScreenEditConvert.pas
+++ b/src/screens/UScreenEditConvert.pas
@@ -578,7 +578,7 @@ begin
for Pet := 0 to High(ATrack) do begin
SetFontPos(11, Y + 10 + Pet*YSkip);
SetFontSize(15);
- glPrint(pchar(ATrack[Pet].Name));
+ glPrint(ATrack[Pet].Name);
end;
for Pet := 0 to High(ATrack) do
diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas
index 541400fd..5681035f 100644
--- a/src/screens/UScreenOptionsRecord.pas
+++ b/src/screens/UScreenOptionsRecord.pas
@@ -651,7 +651,7 @@ var
x1, y1, x2, y2: single;
i: integer;
ToneBoxWidth: real;
- ToneString: PChar;
+ ToneString: string;
ToneStringWidth, ToneStringHeight: real;
ToneStringMaxWidth: real;
ToneStringCenterXOffset: real;
@@ -718,7 +718,7 @@ begin
// draw the name of the tone
///////
- ToneString := PChar(PreviewChannel[State.ChannelIndex].ToneString);
+ ToneString := PreviewChannel[State.ChannelIndex].ToneString;
ToneStringHeight := ChannelBarsTotalHeight;
// initialize font
diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas
index 1267bab8..b6384b79 100644
--- a/src/screens/UScreenSing.pas
+++ b/src/screens/UScreenSing.pas
@@ -550,9 +550,9 @@ begin
// set custom options
case Ini.LyricsFont of
- 0:
+ 0: // normal fonts
begin
- Lyrics.FontStyle := 0;
+ Lyrics.FontStyle := 0;
Lyrics.LineColor_en.R := Skin_FontR;
Lyrics.LineColor_en.G := Skin_FontG;
@@ -564,33 +564,14 @@ begin
Lyrics.LineColor_dis.B := 0.4;
Lyrics.LineColor_dis.A := 1;
- Lyrics.LineColor_act.R := 5 / 256;
- Lyrics.LineColor_act.G := 163 / 256;
- Lyrics.LineColor_act.B := 210 / 256;
+ Lyrics.LineColor_act.R := 0.02;
+ Lyrics.LineColor_act.G := 0.6;
+ Lyrics.LineColor_act.B := 0.8;
Lyrics.LineColor_act.A := 1;
end;
- 1:
- begin
- Lyrics.FontStyle := 2;
-
- Lyrics.LineColor_en.R := 0.75;
- Lyrics.LineColor_en.G := 0.75;
- Lyrics.LineColor_en.B := 1;
- Lyrics.LineColor_en.A := 1;
-
- Lyrics.LineColor_dis.R := 0.8;
- Lyrics.LineColor_dis.G := 0.8;
- Lyrics.LineColor_dis.B := 0.8;
- Lyrics.LineColor_dis.A := 1;
-
- Lyrics.LineColor_act.R := 0.5;
- Lyrics.LineColor_act.G := 0.5;
- Lyrics.LineColor_act.B := 1;
- Lyrics.LineColor_act.A := 1;
- end;
- 2:
+ 1, 2: // outline fonts (is TScalableOutlineFont)
begin
- Lyrics.FontStyle := 3;
+ Lyrics.FontStyle := Ini.LyricsFont + 1;
Lyrics.LineColor_en.R := 0.75;
Lyrics.LineColor_en.G := 0.75;
diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas
index 1002b964..c4d4723f 100644
--- a/src/screens/UScreenSingModi.pas
+++ b/src/screens/UScreenSingModi.pas
@@ -690,7 +690,7 @@ begin
// used by Hold_The_Line / TeamDuell
SetFontSize(Size * 3);
SetFontPos (X, Y);
- glPrint (PChar(Language.Translate(String(Text))));
+ glPrint (Language.Translate(String(Text)));
end;
function LoadSound(const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound