2.9.16
Coherent GT
A modern user interface library for games
Sample - IME and font API

This sample demonstrates how to use Coherent GT's IME and Add Font API

Note
Supplied code is not representative for a well-designed, high-performance solution. It's written for simplicity and its purpose is to demonstrate features of Coherent GT.

Building the IME and Add Font API sample

The sample solution is based on a minimal game framework that provides basic functionality. The sample is already configured and you only have to compile and run it.

The output will be in the Coherent/bin directory.

Prerequisites

This sample builds upon the HelloGT sample and and assumes that you understand it.

Key points

  1. Demonstration of UISystem font manipulation API
  2. Coherent GT input support

Sample walk-through

  1. The Sample disables loading of system fonts thus effectively validating that the fonts are read from internal folder ("fonts") containing fonts needed to display Chinese symbols
  2. The displayed English text is using Times New Roman font which is not loaded along with the other fonts - instead it is preloaded taking advantage of the other font API method - AddFont. What is important to notice about the correct usage is that the buffer provided to the method is kept in a static container because Coherent GT is not to copy any font data internally - the framework using the API is responsible for the lifetime of its font data. Any attempt to use the font after the buffer is destroyed therefore would lead to the well known undefined behaviour.
  3. The sample HTML contains a simple form used to test the input support. Enable Chinese language to test specifically the IME funtionality.