Kanzi Graphics Engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
kzu_glyph_cache.h File Reference

Glyph cache. More...

Functions

kzsError kzuGlyphCacheCreate (const struct KzcMemoryManager *memoryManager, const struct KzuResourceManager *resourceManager, struct KzuImageTexture *texture, struct KzuFont *font, kzFloat glyphSize, struct KzuGlyphCache **out_glyphCache)
 Creates a glyph cache. More...
 
kzsError kzuGlyphCacheDelete (struct KzuGlyphCache *glyphCache)
 Deletes a glyph cache. More...
 
kzsError kzuGlyphCacheClear (struct KzuGlyphCache *glyphCache)
 Removes all stored glyphs from the cache. More...
 
kzsError kzuGlyphCacheRemove (struct KzuGlyphCache *glyphCache, kzUint glyph)
 Removes a stored glyph from the cache. More...
 
kzsError kzuGlyphCacheRetrieveTextureCoordinates (struct KzuGlyphCache *glyphCache, kzUint glyph, kzBool *out_success, kzFloat *out_leftU, kzFloat *out_topV, kzFloat *out_rightU, kzFloat *out_bottomV)
 Retrieves texture coordinates for a given glyph. More...
 
kzsError kzuGlyphCacheRetrieveTextureCoordinatesRecycling (struct KzuGlyphCache *glyphCache, kzUint glyph, kzFloat *out_leftU, kzFloat *out_topV, kzFloat *out_rightU, kzFloat *out_bottomV)
 Retrieves texture coordinates for a given glyph. More...
 
kzsError kzuGlyphCacheRetrieveMultipleTextureCoordinates (struct KzuGlyphCache *glyphCache, const kzUint *glyphs, kzUint glyphCount, kzUint stride, kzUint *out_count, kzByte *out_data)
 Retrieves texture coordinates for multiple glyphs. More...
 
kzsError kzuGlyphCacheRetrieveMultipleTextureCoordinatesWithClipping (struct KzuGlyphCache *glyphCache, const kzUint *glyphs, kzUint glyphCount, kzUint stride, const kzFloat *clippingCoordinates, kzUint *out_count, kzByte *out_data)
 Retrieves texture coordinates for multiple glyphs that might be partially clipped. More...
 
struct KzuImageTexturekzuGlyphCacheGetTexture (const struct KzuGlyphCache *glyphcache)
 Returns the texture that the cache was created with. More...
 

Detailed Description

Glyph cache.

Copyright 2008-2019 by Rightware. All rights reserved.

Function Documentation

kzsError kzuGlyphCacheCreate ( const struct KzcMemoryManager memoryManager,
const struct KzuResourceManager resourceManager,
struct KzuImageTexture texture,
struct KzuFont font,
kzFloat  glyphSize,
struct KzuGlyphCache **  out_glyphCache 
)

Creates a glyph cache.

The texture should be in alpha_8 format.

kzsError kzuGlyphCacheDelete ( struct KzuGlyphCache glyphCache)

Deletes a glyph cache.

kzsError kzuGlyphCacheClear ( struct KzuGlyphCache glyphCache)

Removes all stored glyphs from the cache.

kzsError kzuGlyphCacheRemove ( struct KzuGlyphCache glyphCache,
kzUint  glyph 
)

Removes a stored glyph from the cache.

kzsError kzuGlyphCacheRetrieveTextureCoordinates ( struct KzuGlyphCache glyphCache,
kzUint  glyph,
kzBool out_success,
kzFloat out_leftU,
kzFloat out_topV,
kzFloat out_rightU,
kzFloat out_bottomV 
)

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'.

kzsError kzuGlyphCacheRetrieveTextureCoordinatesRecycling ( struct KzuGlyphCache glyphCache,
kzUint  glyph,
kzFloat out_leftU,
kzFloat out_topV,
kzFloat out_rightU,
kzFloat out_bottomV 
)

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.

kzsError kzuGlyphCacheRetrieveMultipleTextureCoordinates ( struct KzuGlyphCache glyphCache,
const kzUint glyphs,
kzUint  glyphCount,
kzUint  stride,
kzUint out_count,
kzByte out_data 
)

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.

kzsError kzuGlyphCacheRetrieveMultipleTextureCoordinatesWithClipping ( struct KzuGlyphCache glyphCache,
const kzUint glyphs,
kzUint  glyphCount,
kzUint  stride,
const kzFloat clippingCoordinates,
kzUint out_count,
kzByte out_data 
)

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

struct KzuImageTexture* kzuGlyphCacheGetTexture ( const struct KzuGlyphCache glyphcache)

Returns the texture that the cache was created with.