kzu_glyph_cache.h File Reference

Glyph cache. More...

Namespaces

 kanzi
 

Functions

KANZI_API KzuGlyphCachekzuGlyphCacheCreate (kanzi::ResourceManager *resourceManager, kanzi::TextureSharedPtr texture, KzuFont *font, kzFloat glyphSize)
 Creates a glyph cache. More...
 
KANZI_API kzsError kzuGlyphCacheDelete (struct KzuGlyphCache *glyphCache)
 Deletes a glyph cache. More...
 
KANZI_API kzsError kzuGlyphCacheClear (struct KzuGlyphCache *glyphCache)
 Removes all stored glyphs from the cache. More...
 
KANZI_API kzsError kzuGlyphCacheRemove (struct KzuGlyphCache *glyphCache, kzUint glyph, kanzi::FontHintingPreference hintingPreference=kanzi::FontHintingPreferenceNativeHinting)
 Removes a stored glyph from the cache. More...
 
KANZI_API kzsError kzuGlyphCacheRetrieveTextureCoordinates (struct KzuGlyphCache *glyphCache, kzUint glyph, kzBool *out_success, kzFloat *out_leftU, kzFloat *out_topV, kzFloat *out_rightU, kzFloat *out_bottomV, kanzi::FontHintingPreference hintingPreference=kanzi::FontHintingPreferenceNativeHinting)
 Retrieves texture coordinates for a given glyph. More...
 
KANZI_API kzsError kzuGlyphCacheRetrieveTextureCoordinatesRecycling (struct KzuGlyphCache *glyphCache, kzUint glyph, kzFloat *out_leftU, kzFloat *out_topV, kzFloat *out_rightU, kzFloat *out_bottomV, kanzi::FontHintingPreference hintingPreference=kanzi::FontHintingPreferenceNativeHinting)
 Retrieves texture coordinates for a given glyph. More...
 
KANZI_API kzsError kzuGlyphCacheRetrieveMultipleTextureCoordinates (struct KzuGlyphCache *glyphCache, const kzUint *glyphs, kzUint glyphCount, kzUint stride, kzUint *out_count, kzByte *out_data, kanzi::FontHintingPreference hintingPreference=kanzi::FontHintingPreferenceNativeHinting)
 Retrieves texture coordinates for multiple glyphs. More...
 
KANZI_API kzsError kzuGlyphCacheRetrieveMultipleTextureCoordinatesWithClipping (struct KzuGlyphCache *glyphCache, const kzUint *glyphs, kzUint glyphCount, kzUint stride, const kzFloat *clippingCoordinates, kzUint *out_count, kzByte *out_data, kanzi::FontHintingPreference hintingPreference=kanzi::FontHintingPreferenceNativeHinting)
 Retrieves texture coordinates for multiple glyphs that might be partially clipped. More...
 
KANZI_API kanzi::TextureSharedPtr kzuGlyphCacheGetTexture (const struct KzuGlyphCache *glyphcache)
 Returns the texture that the cache was created with. More...
 

Detailed Description

Glyph cache.

Copyright 2008-2017 by Rightware. All rights reserved.

Function Documentation

KANZI_API KzuGlyphCache* kzuGlyphCacheCreate ( kanzi::ResourceManager resourceManager,
kanzi::TextureSharedPtr  texture,
KzuFont font,
kzFloat  glyphSize 
)

Creates a glyph cache.

The texture should be in alpha_8 format.

KANZI_API kzsError kzuGlyphCacheDelete ( struct KzuGlyphCache glyphCache)

Deletes a glyph cache.

KANZI_API kzsError kzuGlyphCacheClear ( struct KzuGlyphCache glyphCache)

Removes all stored glyphs from the cache.

KANZI_API kzsError kzuGlyphCacheRemove ( struct KzuGlyphCache glyphCache,
kzUint  glyph,
kanzi::FontHintingPreference  hintingPreference = kanzi::FontHintingPreferenceNativeHinting 
)

Removes a stored glyph from the cache.

KANZI_API kzsError kzuGlyphCacheRetrieveTextureCoordinates ( struct KzuGlyphCache glyphCache,
kzUint  glyph,
kzBool out_success,
kzFloat out_leftU,
kzFloat out_topV,
kzFloat out_rightU,
kzFloat out_bottomV,
kanzi::FontHintingPreference  hintingPreference = kanzi::FontHintingPreferenceNativeHinting 
)

Retrieves texture coordinates for a given glyph.

If the glyph is not in the glyph cache texture, it is rendered there using the font that was given when creating the glyph cache. In this case, if there is no more empty space left in the glyph cache for the new glyph, then no texture coordinates are written and KZ_FALSE is written to the output parameter 'success'.

KANZI_API kzsError kzuGlyphCacheRetrieveTextureCoordinatesRecycling ( struct KzuGlyphCache glyphCache,
kzUint  glyph,
kzFloat out_leftU,
kzFloat out_topV,
kzFloat out_rightU,
kzFloat out_bottomV,
kanzi::FontHintingPreference  hintingPreference = kanzi::FontHintingPreferenceNativeHinting 
)

Retrieves texture coordinates for a given glyph.

If the glyph is not in the glyph cache texture, it is rendered there using the font that was given when creating the glyph cache. In this case, if there is no more empty space left in the glyph cache for the new glyph, then old glyphs are recycled in the least recently used order.

KANZI_API kzsError kzuGlyphCacheRetrieveMultipleTextureCoordinates ( struct KzuGlyphCache glyphCache,
const kzUint glyphs,
kzUint  glyphCount,
kzUint  stride,
kzUint out_count,
kzByte out_data,
kanzi::FontHintingPreference  hintingPreference = kanzi::FontHintingPreferenceNativeHinting 
)

Retrieves texture coordinates for multiple glyphs.

If a glyph is not found in the glyph cache texture, it is rendered there using the font that was given when creating the glyph cache. The 12 texture coordinates of a glyph are written to the output parameter 'data'. If there is no more empty space left in the glyph cache for a new glyph, then that glyph and the following glyphs are not written. The amount of glyphs written is returned in the 'count' output parameter.

KANZI_API kzsError kzuGlyphCacheRetrieveMultipleTextureCoordinatesWithClipping ( struct KzuGlyphCache glyphCache,
const kzUint glyphs,
kzUint  glyphCount,
kzUint  stride,
const kzFloat clippingCoordinates,
kzUint out_count,
kzByte out_data,
kanzi::FontHintingPreference  hintingPreference = kanzi::FontHintingPreferenceNativeHinting 
)

Retrieves texture coordinates for multiple glyphs that might be partially clipped.

KANZI_API kanzi::TextureSharedPtr kzuGlyphCacheGetTexture ( const struct KzuGlyphCache glyphcache)

Returns the texture that the cache was created with.