Adjusting the Quality of TrueType Font Text (Part 1 of 2)

Andrew Markovich

January 24, 2019

Introduction

 

There are two ways that ODA software can vectorize TrueType fonts:

 

  • Constant text quality (default) — Curves inside TrueType fonts are tessellated by default, so characters are drawn as simple shell primitives with a constant number of vertices.
  • Dynamic TTF PolyDraw mode — Bezier curve information is additionally passed into the geometry conveyor, so client code can tessellate text using any quality that is required for TrueType fonts processing.

The best way depends on application requirements. Constant text quality adjustment is usually a better fit for exports, rendering into raster images, and so on. For dynamic applications such as editors and viewers, the better fit is usually TTF PolyDraw mode, which can increase or decrease text rendering quality depending on zoom level, memory limitations, and other requirements.

Constant TrueType font text quality adjustment works for all platforms. TTF PolyDraw mode is currently supported only for desktop Windows operating systems.

Constant text quality of TrueType fonts (default)

TrueType font text vectorized with default quality:

 

image1

 

Zoomed in to a piece of TrueType font text vectorized with default quality:

 

image2

 

By default, text quality is set at 50%. The following images show the text quality overridden to 75%:

 

image3image 4

 

Generated text is tessellated more accurately, but some minor angularity is still visible on zoomed text. Increase text quality to 100% and the resulting text tessellation looks ideal:

image5

 

Adjusting constant text quality for .dwg files

 

For .dwg files, constant text quality can be changed using the “TEXTQLTY” system variable. By default it is set to 50%. ODA documentation describes how system variables can be changed programmatically: Getting and Setting a System Variable (login required). You can use the console to change this variable in OdaMfcApp and TeighaViewer examples. Don’t forget to call the REGEN command after changing the system variable to regenerate the graphics cache if it is enabled.

 

Adjusting constant text quality in general

 

The general way to adjust text vectorization quality is to override the OdGiContext::textQuality() method (see ODA documentation, login required). This works for all ODA products that use Visualize SDK. OdGiContext is invoked by all vectorization processes, so the textQuality() method can be used to adjust TrueType font text quality in any area. By default the textQuality() method returns that the quality is set to 50%. Each ODA product, Drawings (for both .dwg and .dgn files), BIM, and PRC, have their own implementations of OdGiContext; for example in Drawings SDK this class is called OdGiContextForDbDatabase. Each OdGiContext implementation can have their own override and implementation of the textQuality() method as in OdGiContextForDbDatabase, but there is no problem to override this method once more in your own class inherited from the required OdGiContext implementation, and pass it to the ODA vectorization framework.

 

The next article in this series will describe working with TTF PolyDraw mode.