aboutsummaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-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
6 files changed, 38 insertions, 25 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;