mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-27 23:29:39 +02:00
aggpas: started pango fonts
git-svn-id: trunk@23067 -
This commit is contained in:
parent
37681395ae
commit
3c2c52b282
@ -51,6 +51,7 @@
|
||||
<Version Value="8"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)/"/>
|
||||
<LCLWidgetType Value="gtk2"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
|
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, FileUtil, LResources, Forms, Controls, Graphics,
|
||||
Dialogs, FPimage, agg_fpimage, Agg_LCL;
|
||||
Dialogs, FPimage, agg_fpimage, Agg_LCL, pango, LCLType, GTKProc, GtkDef, gtk2;
|
||||
|
||||
type
|
||||
|
||||
@ -20,6 +20,7 @@ type
|
||||
public
|
||||
AggLCLCanvas: TAggLCLCanvas;
|
||||
Bitmap1: TBitmap;
|
||||
procedure CreatePangoFont(AggFont: TAggLCLFont);
|
||||
end;
|
||||
|
||||
var
|
||||
@ -45,11 +46,7 @@ begin
|
||||
Image.PixelFormat:=afpimRGBA32;
|
||||
Image.SetSize(500,500);
|
||||
end;
|
||||
{$IFDEF LCLGtk2}
|
||||
HasFont:=true;
|
||||
{$ELSE}
|
||||
HasFont:=false;
|
||||
{$ENDIF}
|
||||
|
||||
// paint to agg canvas
|
||||
with AggLCLCanvas do begin
|
||||
@ -110,6 +107,24 @@ begin
|
||||
Canvas.Draw(0,0,Bitmap1);
|
||||
end;
|
||||
|
||||
procedure TForm1.CreatePangoFont(AggFont: TAggLCLFont);
|
||||
var
|
||||
FullString: String;
|
||||
PangoDesc: PPangoFontDescription;
|
||||
PangoLayout: PPangoLayout;
|
||||
begin
|
||||
FullString := AggFont.Name+' '+IntToStr(AggFont.Size);
|
||||
PangoDesc := pango_font_description_from_string(PChar(FullString));
|
||||
if AggFont.Bold then
|
||||
pango_font_description_set_weight(PangoDesc, FW_BOLD);
|
||||
if AggFont.Italic then
|
||||
pango_font_description_set_style(PangoDesc, PANGO_STYLE_ITALIC);
|
||||
pango_font_description_set_size(PangoDesc, AggFont.Size*PANGO_SCALE);
|
||||
PangoLayout:=gtk_widget_create_pango_layout(GetStyleWidget(lgsdefault), nil);
|
||||
pango_layout_set_font_description(PangoLayout,PangoDesc);
|
||||
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I unit3.lrs}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user