<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Oct 20, 2016 at 10:48 AM, Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2016-10-20 16:41 GMT+02:00 David Lonie <<a href="mailto:david.lonie@kitware.com">david.lonie@kitware.com</a>>:<br>
> Correct -- Set ForceCompiledFonts off on vtkFreeTypeTools, and set the name<br>
> of the font using vtkTextProperty::<wbr>SetFontFamilyAsString.<br>
><br>
> As you discovered, this requires the RenderingFreeTypeFontConfig module to<br>
> be enabled and linked to the final application. There is an example usage in<br>
> Rendering/FreeTypeFontConfig/<wbr>Testing/Cxx/<wbr>TestSystemFontRendering.cxx if you<br>
> get stuck.<br>
><br>
> Let us know if you have further issues, AFAIK this functionality is not<br>
> widely used.<br>
<br>
Yep, it now seems to work. E.g. I can now do:<br>
<br>
    textProperty->SetFontSize(10);<br>
    textProperty-><wbr>SetFontFamilyAsString("Noto Sans");<br>
<br>
However, one thing puzzles me: The font is much smaller than what I<br>
would have expected. I set it to 10 points here, but the result is<br>
much smaller (see attached screenshot).<br>
<br>
My goal is to use<br>
QFontDatabase::systemFont(<wbr>QFontDatabase::GeneralFont) to get the<br>
system font through Qt, and use its values for .fontSize() and<br>
.family() when constructing my vtkTextProperty, to make the font in<br>
VTK match my system font.<br>
<br>
Any idea why the text is rendered so small? The vtkTextProperty is set<br>
on a vtkTextMapper which in turn is set on a vtkActor2D.<br></blockquote><div><br></div><div>It's hard to say. How does it compare to a VTK built-in font of the same size? The glyph sizes are set by the freetype library, VTK doesn't have much control over this. It just asks the library for glyphs of a certain size/family and draws them into a texture. You may need to set a scaling factor during the conversion if something seems iffy.</div><div><br></div><div>Dave</div></div></div></div>