Log in

View Full Version : Not assigning colours..



Brandon
03-12-2012, 12:07 AM
Why does it not colour the font correctly? Everything else it does but it won't colour it correctly!


{$I SRL/SRL.Simba}
{$I SRL/SRL/Misc/Debug.Simba}

Function Fonts: Boolean;
var
Font: TFont;
BMP: Integer;
begin
//Font.Style = [fsBold, fsItalic, fsUnderline, fsStrikeOut];

Font:= TFont.Create;
Font.Name:= 'Courier New';
Font.Style:= [fsBold, fsItalic];
Font.Size:= 12;
Font.Color:= clRed; //This is the line.. Yet it prints white fonts -__-

if (LoadSystemFont(Font, Font.Name) = False) then
begin
Font.Free;
FreeBitmap(BMP);
RaiseException(erCustomError, 'Invalid Font Name');
end;

BMP:= BitmapFromText('Testing..', Font.Name);

DebugBitmap(BMP);
Font.Free;
FreeBitmap(BMP);
end;

begin
SetupSRL;
Fonts;
end.

bg5
03-12-2012, 01:45 AM
BitmapFromText is OCR function ,which makes black&white bitmap to future use in OCR:
https://github.com/MerlijnWajer/Simba/blob/master/Units/MMLCore/ocr.pas#L1206

But you can still replace clwhite with font color.
FastReplaceColor(bmp,clwhite,font.color);