[vtkusers] Using fontconfig with vtkTextMapper/vtkTextProperty?
David Lonie
david.lonie at kitware.com
Thu Oct 20 10:41:51 EDT 2016
Correct -- Set ForceCompiledFonts off on vtkFreeTypeTools, and set the name
of the font using vtkTextProperty::SetFontFamilyAsString.
As you discovered, this requires the RenderingFreeTypeFontConfig module to
be enabled and linked to the final application. There is an example usage
in Rendering/FreeTypeFontConfig/Testing/Cxx/TestSystemFontRendering.cxx if
you get stuck.
Let us know if you have further issues, AFAIK this functionality is not
widely used.
HTH,
Dave
On Thu, Oct 20, 2016 at 9:34 AM, Elvis Stansvik <
elvis.stansvik at orexplore.com> wrote:
> 2016-10-20 14:49 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
> > 2016-10-20 14:48 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>
> :
> >> 2016-10-20 14:06 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com
> >:
> >>> Hi,
> >>>
> >>> How can I load a system font through fontconfig and use it with
> >>> vtkTextMapper/vtkTextProperty?
> >>>
> >>> I've called vtkFreeTypeTools::GetInstance()->ForceCompiledFontsOff(),
> >>> but I can't find any API on vtkTextProperty to set a font family to
> >>> use for a fontconfig-based search.
> >>
> >> Am I supposed to pass the fontconfig family name (e.g. "Noto Sans") to
> >> vtkTextProperty::SetFontFamilyAsString(..) ? I tried it but it didn't
> >> seem to have any effect.
> >>
> >> In fact, I just had a look at the build log for the Debian package I
> >> built of 7.1.0.rc1, and it's not mentioning "FontConfig" at all (see
> >> attached log). Does that mean my build doesn't have fontconfig
> >
> > Sorry, forgot the attachment, here it is in case it's too big to be
> attached:
> >
> > https://dl.dropboxusercontent.com/u/22350696/vtk7_7.1.0~rc1-
> 0ubuntu1_amd64.build.bz2
> >
> > Elvis
>
> Sorry for the noise. Just adding
> -DModule_vtkRenderingFreeTypeFontConfig=ON to my build and
> libfontconfig1-dev to the build dependencies, and I get
>
> -- * vtkRenderingFreeTypeFontConfig, requested by
> Module_vtkRenderingFreeTypeFontConfig.
>
> in the VTK CMake output. Building now and will report back how it went.
>
> Still interested in if vtkTextProperty::SetFontFamilyAsString(..) is
> the right API to set the fontconfig family name.
>
> Elvis
>
> >
> >> support? Must I enable the FreeTypeFontConfig module explicitly? (not
> >> enough that fontconfig is found on the system?).
> >>
> >> Elvis
> >>
> >>>
> >>> Elvis
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161020/0934fba2/attachment.html>
More information about the vtkusers
mailing list