Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

SVG backend does not work with the freetype renderer #1329

Open
selwynsimsek opened this issue Jan 10, 2023 · 3 comments
Open

SVG backend does not work with the freetype renderer #1329

selwynsimsek opened this issue Jan 10, 2023 · 3 comments

Comments

@selwynsimsek
Copy link

I prefer to use the freetype renderer as it lets one use OTF fonts, which is useful for current purposes.

After setting it up following the instructions at https://github.com/McCLIM/McCLIM/wiki/Freetype, the X backend works as desired.

However the SVG backend does not work. Executing the following code

 (with-output-to-drawing-stream (*standard-output* :svg #p"/tmp/abc.svg") )

gives the following error

The value of CLIM-FREETYPE::FONT is #<MCCLIM-TRUETYPE:CACHED-TRUETYPE-FONT  size=14 ascent=13307/1024 descent=3381/1024 units->pixels=7/1024>, which is not of type CLIM-FREETYPE::FREETYPE-FONT.

When the freetype renderer is disabled, this code produces a blank SVG file as expected, so the issue lies in the intersection of the SVG backend and the freetype renderer. This issue occurs even without attempting to draw any text.

From the looks of things the SVG backend expects the truetype renderer.

@selwynsimsek
Copy link
Author

The truetype ports and medium mixins occur here

https://github.com/McCLIM/McCLIM/blob/master/Backends/SVG/svg-backend.lisp#L7
and
https://github.com/McCLIM/McCLIM/blob/master/Backends/SVG/svg-backend.lisp#L90

I believe these should change if :mcclim-ffi-freetype is present in features. However replacing them with what I assume are their counterparts clim-freetype:clx-freetype-port and clim-freetype::clx-freetype medium merely leads to different errors. I dont know how best to proceed, though it seems that these are the only places in which it is assumed by the svg backend that the truetype renderer is being used

@dkochmanski
Copy link
Member

Are you sure that it is not due to a stale fasl cache? IIRC freetype and truetype renderers may be used at the same time for different ports so there shouldn't be a problem. Please try reloading after removing all fasl files.

Alternatively (and both potential issues are not mutually exclusive), text-style-mapping around method caches incorrectly a truetype font (I can't tell without investigating myself). Generally mcclim-svg should not have its calls dispatched to the freetype renderer, so perhaps investigating from this angle would help.

@selwynsimsek
Copy link
Author

OK. I do remove fasl caches whenever I switch between renderers, as it has caused issues in the past.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants