Closed art-w closed 8 years ago
Thanks ! Will have a look at all this when I get some time.
Bold (arbitrarily chosen at W600.)
Could you rather use W700 for this ? This would make it consistent with CSS, see http://www.w3.org/TR/CSS2/fonts.html#font-boldness
Best,
Daniel
The rcairo demo has an additional -format argument to specify the file backend. Let me know if I overlooked anything! You can merge this Pull Request by running git pull https://github.com/art-w/vg cairo2 Or view, comment on, or merge it at: https://github.com/dbuenzli/vg/pull/7 Commit Summary Add a cairo2 renderer to the build system Add a minimal cairo2 example Vgr_cairo2: cost semantics Vgr_cairo2: subset implementation based on Vgr_htmlc Vgr_cairo2: stroke and dash Vgr_cairo2: gradients Vgr_cairo2: glyphs Add Vgr_cairo2 to the doc build Vgr_cairo2: multiple images Vgr_cairo2: document the API Vgr_cairo2: coding convention Vgr_cairo2: quadratic curves Vgr_cairo2: correct sizing of minimal example Vgr_cairo2: add PNG and PSD targets Vgr_cairo2: bugfix, gradients and arcs Vgr_cairo2: bugfix, sRGB Vgr_cairo2: update minimal example to output PNG Vgr_cairo2: output db examples to PDF Rstored: allow renderers to have multiple file formats Vgr_cairo2: rcairo2 has multiple formats Add cairo2 to .merlin Vgr_cairo2: add PS and SVG formats Vgr_cairo2: update copyright Rename to Vgr_cairo Vgr_cairo: update dependencies in README Vgr_cairo: documentation Vgr_cairo: resolution Vgr_cairo: update min_cairo example Vgr_cairo: documentation, correct resolution Vgr_cairo: small adjustments
File Changes M .merlin (https://github.com/dbuenzli/vg/pull/7/files#diff-0) (2)
M README.md (https://github.com/dbuenzli/vg/pull/7/files#diff-1) (14)
M _tags (https://github.com/dbuenzli/vg/pull/7/files#diff-2) (9)
M build (https://github.com/dbuenzli/vg/pull/7/files#diff-3) (2)
M doc/api.odocl (https://github.com/dbuenzli/vg/pull/7/files#diff-4) (1)
M doc/dev-api.odocl (https://github.com/dbuenzli/vg/pull/7/files#diff-5) (3)
M opam (https://github.com/dbuenzli/vg/pull/7/files#diff-6) (3)
M pkg/META (https://github.com/dbuenzli/vg/pull/7/files#diff-7) (11)
M pkg/build.ml (https://github.com/dbuenzli/vg/pull/7/files#diff-8) (3)
A src/vgr_cairo.ml (https://github.com/dbuenzli/vg/pull/7/files#diff-9) (439)
A src/vgr_cairo.mli (https://github.com/dbuenzli/vg/pull/7/files#diff-10) (117)
A src/vgr_cairo.mllib (https://github.com/dbuenzli/vg/pull/7/files#diff-11) (1)
A test/min_cairo.ml (https://github.com/dbuenzli/vg/pull/7/files#diff-12) (36)
A test/rcairo.ml (https://github.com/dbuenzli/vg/pull/7/files#diff-13) (58)
M test/rstored.ml (https://github.com/dbuenzli/vg/pull/7/files#diff-14) (17)
M test/tests.itarget (https://github.com/dbuenzli/vg/pull/7/files#diff-15) (4)Patch Links: https://github.com/dbuenzli/vg/pull/7.patch https://github.com/dbuenzli/vg/pull/7.diff
— Reply to this email directly or view it on GitHub (https://github.com/dbuenzli/vg/pull/7).
Are the glyph examples rendering correctly on your side ? Here it seems that none do. E.g. rendering pie-ambiguity to PNG gives:
Uh, yes, they do. I'm not sure what's going on. Is it the correct font, or does cairo defaults to something else ?
Uh, yes, they do.
Ok cool. I was suspecting that.
I'm not sure what's going on. Is it the correct font, or does cairo defaults to something else ?
I'm using cairo on on osx. That may explain some things. I'll try to have a closer look at it.
I don't have a clue, but I only tested in on linux since I don't have access to anything else. I'll let you know if I think of some other explanation. You can also send me the rendering by mail if the bug isn't always "the texts are 50x larger than they should", it could help. Otherwise, the outputs I have are identical to the pdf backend (except for the gradients which are subtly not computed in the correct colorspace, but that's all.)
"the texts are 50x larger than they should",
Yes that's the symptom. I don't think the problem is with your code. It seems rather to be a bug in cairo. See https://github.com/graphite-project/graphite-web/issues/1191#issuecomment-112208463.
Btw. @Chris00 I was trying to support multiple page output and it seems I get the following assertion failure:
Assertion failed: (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count)), function cairo_surface_destroy, file cairo-surface.c, line 930.
/bin/bash: line 1: 86018 Abort trap: 6 ./rcairo.native -pack bla -format ps
Any idea ?
Any idea ?
Never mind can no longer reproduce...
Ok so your PR has been squashed and merged as bbcabd4480a0b411 I changed a bit the API and made stored renderer for pdf and ps support multiple page output. Thanks for bootstrapping this and sorry again for the long delay. Release coming soon.
Great! Thanks for taking the time to make so many fixes, I'm very happy with all the improvements you made. Have a nice day!
The main motivation for this backend is the ability to rasterize a Vg image to a custom surface in memory, but it can also be used to produce PNG and PS files (and more redundantly, PDF and SVG.) It adds an optional dependency to the
cairo2
bindings for OCaml.The implementation is based on the existing Vgr_htmlc renderer, as the semantics of the javascript canvas are very close to the cairo surface model, with the following known limitations:
W600
.)The
rcairo
demo has an additional-format
argument to specify the file backend.Let me know if I overlooked anything!