diff --git a/.gitattributes b/.gitattributes index 8d0479781e..d8cbb6d568 100644 --- a/.gitattributes +++ b/.gitattributes @@ -630,6 +630,8 @@ components/cairocanvas/cairocanvas_pkg.pas svneol=native#text/plain components/cairocanvas/cairocanvasall.pas svneol=native#text/plain components/cairocanvas/cairographics.pas svneol=native#text/plain components/cairocanvas/cairoprinter.pas svneol=native#text/pascal +components/cairocanvas/example/cairoprog.lpi svneol=native#text/plain +components/cairocanvas/example/cairoprog.lpr svneol=native#text/pascal components/cairocanvas/tests/24217/project1.lpi svneol=native#text/plain components/cairocanvas/tests/24217/project1.lpr svneol=native#text/pascal components/cairocanvas/tests/24217/unit1.lfm svneol=native#text/plain diff --git a/components/cairocanvas/example/cairoprog.lpi b/components/cairocanvas/example/cairoprog.lpi new file mode 100644 index 0000000000..ef56b810a0 --- /dev/null +++ b/components/cairocanvas/example/cairoprog.lpi @@ -0,0 +1,69 @@ + + + + + + + + + + + + + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="cairocanvas_pkg"/> + </Item1> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="cairoprog.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="cairoprog"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="cairoprog"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/components/cairocanvas/example/cairoprog.lpr b/components/cairocanvas/example/cairoprog.lpr new file mode 100644 index 0000000000..ea0644d6e6 --- /dev/null +++ b/components/cairocanvas/example/cairoprog.lpr @@ -0,0 +1,28 @@ +program cairoprog; + +{$mode objfpc}{$H+} + +uses + Classes, CairoCanvas; + +var // This could also be TCairoSvgCanvas, TCairoPngCanvas or TCairoPsCanvas + PrinterCanvas: TCairoPdfCanvas; +begin + PrinterCanvas := TCairoPdfCanvas.Create; + try + PrinterCanvas.OutputFileName := 'CairoCanvas.pdf'; + PrinterCanvas.Ellipse(20, 20, 170, 120); + //PrinterCanvas.XDPI := 75; // These have valid default values. + //PrinterCanvas.YDPI := 75; + //PrinterCanvas.PaperWidth := 250; + //PrinterCanvas.PaperHeight := 500; + PrinterCanvas.Font.Name := 'Arial'; // Font properties must be set, does not work otherwise. + PrinterCanvas.Font.Height := 24; + PrinterCanvas.TextOut(50, 150, 'abcdefghijklmnopqrstuvwxyzåäö'); + WriteLn('Written file ' + PrinterCanvas.OutputFileName); + ReadLn; + finally + PrinterCanvas.Free; + end; +end. +