[vtk-developers] Using system fonts on Windows (fontconfig equivalent?)

Elvis Stansvik elvis.stansvik at orexplore.com
Tue Apr 11 15:54:20 EDT 2017


2017-04-11 18:43 GMT+02:00 David Lonie <david.lonie at kitware.com>:
> AFAIK, the only option on windows would be to load the font file
> directly using vtkTextProperty::SetFontFamily(VTK_FONT_FILE) and
> vtkTextProperty::SetFontFile(...). I've never heard of FontConfig
> being used on Windows, but I haven't really looked into it, either.

Hm, alright.

QFont (as returned by QFontDatabase::system(...) etc.) unfortunately
can't give me a specific font file (it's not part of its API, QFont
should actually be thought of as query to the underlying font backend,
not a specific font file), so I don't have a file path to pass to
SetFontFile :/

Would it make sense as future improvement to add a VTK module similar
to vtkRenderingFreeTypeFontConfig, but which interfaces with the
Windows font backend?

How are people dealing with this in VTK applications today? Do they
just accept that fonts in VTK will look out of place compared to
surrounding UI elements and other programs (and not respecting the
user's font settings)? What's the situation on macOS? We're planning a
port to macOS as well, and would of course like to respect the user's
font choice there as well.

Elvis

>
> Good luck!
>
> Dave
>
> On Tue, Apr 11, 2017 at 4:45 AM, Elvis Stansvik
> <elvis.stansvik at orexplore.com> wrote:
>> Hi all,
>>
>> Cross-posting since I'm not sure if vtkusers@ or vtk-developers@ is
>> most appropriate for this.
>>
>> On Linux, I'm using the vtkRendereringFreeTypeFontConfig module, so
>> that I can use system fonts (e.g. for charts labels et.c). The goal is
>> to make VTK fonts match those used by Qt, so I'm using
>> QFontDatabase::system(...) to query for the user's preferred font, and
>> then use that in my VTK code. This is all working quite well.
>>
>> I'm now porting the application to Windows. Does VTK have any support
>> for loading system fonts on Windows? Something similar to the
>> vtkRendereringFreeTypeFontConfig, but for whatever font backend
>> Windows uses?
>>
>> If not, has anyone had luck in building fontconfig for Windows, and
>> using the vtkRendereringFreeTypeFontConfig module there? (I'm not even
>> sure if fontconfig has support for hooking into Windows' font backend,
>> so this may not be a solution at all).
>>
>> Many thanks in advance,
>> Elvis
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>


More information about the vtk-developers mailing list