Index

CDTEngineV8

TypesetterSetCachePolicy

This function activates certain rules/restrictions that are respected when the Typesetter makes decisions on whether to store glyph images in the bitmap cache. These rules/restrictions are designed to help utilize the bitmap cache more effectively. For example, application developers may instruct the Typesetter not to cache glyph images that exceed certain size.

When D-Type Engine is initialized, the bitmap cache policy is not set. Consequently, no restrictions are set either. This means that any and all glyph images that fit in the bitmap cache will be cached.

Therefore, call this function if you wish to set your own, more restrictive, bitmap cache policy.

Note that the Typesetter can render glyph images regardless of whether they are cached or not. The bitmap cache merely improves the rendering speed when the same glyph image is rendered more than once.

Parameters

ParameterDescription

max_bitmap_bytes

  • If non-negative, this is the maximum bitmap size, in bytes, of a 8-bpp glyph image that is to be stored in the bitmap cache. Glyph images that exceed this size will not be stored in the bitmap cache.

  • If max_bitmap_bytes is -1 (or any other negative value), this restriction is disabled.

reserved1

Reserved for future use. Must be set to -1.

reserved2

Reserved for future use. Must be set to -1.

reserved3

Reserved for future use. Must be set to -1.

reserved4

Reserved for future use. Must be set to -1.

flag

Specifies action with respect to the Typesetter's bitmap cache. Currently supported values are:

  • flag = 0 — Default behavior for this function (bitmap cache will be cleared only if deemed necessary)
  • flag = 1 — Do not clear the bitmap cache
  • flag = 2 — Force clear the bitmap cache

Return Value

If successful, the return value is 1. Otherwise, the function returns 0.

Comments

Currently the only supported restriction is the restriction on the size of a glyph image. However, in the future additional restrictions may be added.

Note that TypesetterSetSubpixels can completely disable the bitmap cache. Obviously, when the bitmap cache is disabled no glyph images can be cached either (regardless of how you set the bitmap cache policy by calling this function).

Example 1

dtTypesetterSetCachePolicy(engine, 0, -1, -1, -1, -1, 0);

No glyph images will be stored in the bitmap cache (since any valid 8-bpp image will exceed 0 bytes in size).

Example 2

dtTypesetterSetCachePolicy(engine, 10000, -1, -1, -1, -1, 0);

Only glyph images that are 10,000 bytes or less will be stored in the bitmap cache. This means, for example, that a 90x90 pixel 8-bpp glyph image (or smaller) will be stored in the bitmap cache (as long as it fits in it and the bitmap cache is not disabled), while a 110x110 pixel image (or larger) will never be stored in the cache.

Example 3

dtTypesetterSetCachePolicy(engine, -1, -1, -1, -1, -1, 0);

All glyph images that fit in the bitmap cache will be stored there.



 

Index