Here's an example code what I've tried now (on MorphOS):
Code: Select all
@REQUIRE "polybios"
@DISPLAY {Width=595, Height=842, Color=#WHITE}
font$ = "Arial"
;font$ = "System:Fonts/_ttf/Arial.TTF"
size = 24
text$ = "This is a text line!!1 gjyq"
OpenFont(1, font$, size, {Engine = #FONTENGINE_INBUILT})
UseFont(1)
SetFontColor(#BLACK)
SetFontStyle(#ANTIALIAS)
TextOut(0, 0, text$)
doc=pdf.CreateDocument()
page = doc:AddPage()
page:SetSize(#HPDF_PAGE_SIZE_A4, #HPDF_PAGE_PORTRAIT)
font = doc:LoadFont(font$)
;font = doc:LoadTTFont(font$, True)
font = doc:GetFont(font)
page:SetFontAndSize(font, size)
page:BeginText()
page:TextOut(0, 842 - size, text$)
page:EndText()
doc:SaveToFile("ram:test.pdf")
WaitLeftMouse()
Rendered in the Hollywood display it looks like this:
But in the PDF file it looks like this (even when loaded with Polybos itself):
So why it's much bigger in the PDF? Should I scale something according something or how could I get them closer to the same sizes?
Page sizes are same for the display (595x842) and PDF (A4 = 595x842), and font sizes are defined to same 24 for both. PDF coordinates seem to match with Hollywood display with other operations, but only the text looks different.
Any advice or suggestions would be very welcome!