procedure TCoToMap.FontMap(const InChar, FontName: WideString;
FontSize: Integer);
var
bmp : TBitmap;
Font: TFont;
x,y :integer;
pColor :Longint;
//pTmp : pbyte;
begin
mapvalue := '';
errinfo := -1;
bmp := TBitmap.Create;
Font := TFont.Create;
try
Font.Name := FontName;
Font.Size := FontSize;
Font.Charset := 134;
bmp.Canvas.Font.Assign(Font);
bmp.Height :=bmp.Canvas.TextHeight(InChar);
bmp.Width := bmp.Canvas.TextWidth(InChar);
bmp.Canvas.TextOut(0,0,InChar);
for y:=0 to bmp.Height-1 do
begin
for x:=0 to bmp.Width-1 do
begin
pColor:=Bmp.Canvas.Pixels[x,y];
if pColor= 16777215 then
begin
mapvalue := mapvalue + '0';
end else
mapvalue := mapvalue + '1';
end;
mapvalue := mapvalue + '3';
end;
Font.Free;
bmp.Free;
errinfo := 0;
Except
mapvalue := '';
Font.Free;
bmp.Free;
errinfo := -1;
end;
end;