-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use custom font and fill pentagram? #19
Comments
perhaps your font doesn't have
you don't need to do this, it is for internal use
you need to call
this is already a correct way to start using nimPDF
please see |
Thanks for replying, custom font usage has been solved, it has FS_REGULAR. var radius = 13.0
var points : seq[Point2d]
for i in 0..4:
var angle = 2 * PI * i.float / 5 - PI / 2
var x = cx + radius * cos(angle)
var y = cy + radius * sin(angle)
points.add Point2d(x:x,y:y)
doc.setLineWidth(0.1)
doc.setFillColor(initRGB("red"))
for i in 0..4:
var point = points[i*2 mod 5]
var nextPoint = points[(i+1)*2 mod 5]
doc.moveTo(point)
doc.lineTo(nextPoint)
doc.closePath()
doc.fill() It lightens my pentagram instead of filling , how to get it to work? |
#doc.setFillColor(initRGB("maroon"))
doc.moveTo(points[0])
for i in 1..4:
var point = points[i*2 mod 5]
#var nextPoint = points[(i+1)*2 mod 5]
doc.lineTo(point)
#doc.closePath()
doc.fill() yeah, I forgot to mention you also cannot fill line segment. Calling call But you still need to call |
It fills the pentagram now. BTW, I don't quite understand setTextMatrix , |
if anything you need is graphics and not a PDF, use a graphics renderer(nimAGG) although it is very dense and not easy to use. |
fontmanager.nim
KaiTi00: ../demo/fonts/simkai.ttf
Times New Roman00: ../demo/fonts/TimesNewRoman.ttf
FangSong00: ../demo/fonts/simfang.ttf
Eunjin00: ../demo/fonts/Eunjin.ttf
FreeMono00: ../demo/fonts/FreeMono.ttf
LFangSong00: ../demo/fonts/gongzhang.ttf
Calligrapher00: ../demo/fonts/calligra.ttf
setFont("LFangSong") but doesn't take effect.
I'm using demo.nim as a base , here is the code of drawing a pentagram without proper filling, thought recordShape helps, so I made the field accessible explicitly,
associated with some changes of lineTo as follows:
it just doesn't fill the pentagram.
The text was updated successfully, but these errors were encountered: