Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Draw a partial text in a single line without clipping x
- procedure TFixedFont.WriteText2(x, y: integer; Txt: string;
- var PaintBox1: TPaintBox);
- var
- i: cardinal; // PEW
- ch, px, py, TextLength: integer;
- begin
- if (Image = nil) or (Txt = '') then
- exit;
- PaintBox1.Canvas.Lock;
- i := 1;
- TextLength := length(Txt);
- while i <= TextLength do
- begin
- ch := ord(Txt[i]);
- // i=7
- // Txt[i]=111 'o'
- // ch=121
- if (ch >= Rects_low) and (ch <= LastCharacterDefined) then
- begin
- // [ALVAROGP] Rects are not records any more
- for px := 0 to Rects[ch].w - 1 do
- // [ALVAROGP] Rects are not records any more
- for py := 0 to Rects[ch].h - 1 do
- if y + py < PaintBox1.Canvas.ClipRect.Left +
- PaintBox1.Canvas.ClipRect.Bottom - PaintBox1.Canvas.ClipRect.Top
- then
- begin
- if ReverseVideo then
- begin
- // reversed text
- // [ALVAROGP] Rects are not records any more
- if Image.Canvas.Pixels[Rects[ch].x + px, Rects[ch].y + py] =
- TransparentColor then
- PaintBox1.Canvas.Pixels[x + px, y + py] := TextColor
- else if not UseTransparentBackground then
- PaintBox1.Canvas.Pixels[x + px, y + py] := BackgroundColor;
- end
- else
- begin
- // normal text
- // [ALVAROGP] Rects are not records any more
- if Image.Canvas.Pixels[Rects[ch].x + px, Rects[ch].y + py] <>
- TransparentColor then
- PaintBox1.Canvas.Pixels[x + px, y + py] := TextColor
- else if not UseTransparentBackground then
- PaintBox1.Canvas.Pixels[x + px, y + py] := BackgroundColor;
- end
- end;
- x := x + Rects[ch].w + HorizontalGap
- end;
- inc(i);
- end;
- PaintBox1.Canvas.Unlock;
- //PaintBox1.invalidate;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement