#include "r2d/lcds/i_sample/font_bitmap_system.h"
#include "r2d/lcds/i_sample/font_metrics_system.h"
#include "r2d/lcds/i_sample/font_table_system.h"
#include "r2d/lcds/i_sample/font_bitmap_proportional.h"
#include "r2d/lcds/i_sample/font_metrics_proportional.h"
#include "r2d/lcds/i_sample/font_table_proportional.h"
#ifdef RV_CJK
#include "r2d/lcds/i_sample/font_bitmap_cjk_15.h"
#include "r2d/lcds/i_sample/font_metrics_cjk_15.h"
#include "r2d/lcds/i_sample/font_table_cjk_15.h"
#endif
// CJK Support: The bitmap of the font has been split into several segments.
// A font's bitmap containing a huge number of glyphs (character drawings)
// must be split into several segments because of R2D font engine limitation.
//r2d_new_segmented_font(system);
//r2d_new_compressed_font(system);
//r2d_new_segmented_compressed_font(system);
r2d_new_font(system);
//r2d_new_segmented_font(proportional);
//r2d_new_compressed_font(proportional);
//r2d_new_segmented_compressed_font(proportional);
r2d_new_font(proportional);
#ifdef RV_CJK
// CJK Support: Default Simplified Chinese font, size 15
//r2d_new_segmented_font(cjk_15);
//r2d_new_compressed_font(cjk_15);
r2d_new_segmented_compressed_font(cjk_15);
//r2d_new_font(cjk_15);
#endif
/* Cleaning font structures when and error occurs at init */
void r2d_font_clean()
{
r2d_clean_font(system);
r2d_clean_font(proportional);
#ifdef RV_CJK
r2d_clean_font(cjk_15);
#endif
}
T_R2D_ERROR r2d_font_init()
{
UINT16 length;
UINT32 *p;
UINT32 h,v,words;
T_R2D_ERROR ret_err;
ret_err=R2D_OK;
r2d_init_font(system);
if (ret_err!=R2D_OK)
return(ret_err);
r2d_init_font(proportional);
if (ret_err!=R2D_OK)
return(ret_err);
#ifdef RV_CJK
r2d_init_font(cjk_15);
if (ret_err!=R2D_OK)
return(ret_err);
#endif
r2d_init_font_field(R2D_SMALL_SYSTEM_NORMAL,system);
r2d_init_font_field_without_bold(R2D_SMALL_SYSTEM_BOLD,system);
r2d_init_font_field(R2D_SMALL_SYSTEM_ITALIC,system);
r2d_init_font_field_without_bold(R2D_SMALL_SYSTEM_BOLD_ITALIC,system);
r2d_init_font_field(R2D_MEDIUM_SYSTEM_NORMAL,system);
r2d_init_font_field_without_bold(R2D_MEDIUM_SYSTEM_BOLD,system);
r2d_init_font_field(R2D_MEDIUM_SYSTEM_ITALIC,system);
r2d_init_font_field_without_bold(R2D_MEDIUM_SYSTEM_BOLD_ITALIC,system);
r2d_init_font_field(R2D_BIG_SYSTEM_NORMAL,system);
r2d_init_font_field_without_bold(R2D_BIG_SYSTEM_BOLD,system);
r2d_init_font_field(R2D_BIG_SYSTEM_ITALIC,system);
r2d_init_font_field_without_bold(R2D_BIG_SYSTEM_BOLD_ITALIC,system);
#ifdef RV_CJK
r2d_init_font_field(R2D_SMALL_TYPEWRITER_NORMAL,cjk_15);
r2d_init_font_field_without_bold(R2D_SMALL_TYPEWRITER_BOLD,cjk_15);
r2d_init_font_field(R2D_SMALL_TYPEWRITER_ITALIC,cjk_15);
r2d_init_font_field_without_bold(R2D_SMALL_TYPEWRITER_BOLD_ITALIC,cjk_15);
r2d_init_font_field(R2D_MEDIUM_TYPEWRITER_NORMAL,cjk_15);
r2d_init_font_field_without_bold(R2D_MEDIUM_TYPEWRITER_BOLD,cjk_15);
r2d_init_font_field(R2D_MEDIUM_TYPEWRITER_ITALIC,cjk_15);
r2d_init_font_field_without_bold(R2D_MEDIUM_TYPEWRITER_BOLD_ITALIC,cjk_15);
r2d_init_font_field(R2D_BIG_TYPEWRITER_NORMAL,cjk_15);
r2d_init_font_field_without_bold(R2D_BIG_TYPEWRITER_BOLD,cjk_15);
r2d_init_font_field(R2D_BIG_TYPEWRITER_ITALIC,cjk_15);
r2d_init_font_field_without_bold(R2D_BIG_TYPEWRITER_BOLD_ITALIC,cjk_15);
#else
r2d_init_font_field(R2D_SMALL_TYPEWRITER_NORMAL,system);
r2d_init_font_field_without_bold(R2D_SMALL_TYPEWRITER_BOLD,system);
r2d_init_font_field(R2D_SMALL_TYPEWRITER_ITALIC,system);
r2d_init_font_field_without_bold(R2D_SMALL_TYPEWRITER_BOLD_ITALIC,system);
r2d_init_font_field(R2D_MEDIUM_TYPEWRITER_NORMAL,system);
r2d_init_font_field_without_bold(R2D_MEDIUM_TYPEWRITER_BOLD,system);
r2d_init_font_field(R2D_MEDIUM_TYPEWRITER_ITALIC,system);
r2d_init_font_field_without_bold(R2D_MEDIUM_TYPEWRITER_BOLD_ITALIC,system);
r2d_init_font_field(R2D_BIG_TYPEWRITER_NORMAL,system);
r2d_init_font_field_without_bold(R2D_BIG_TYPEWRITER_BOLD,system);
r2d_init_font_field(R2D_BIG_TYPEWRITER_ITALIC,system);
r2d_init_font_field_without_bold(R2D_BIG_TYPEWRITER_BOLD_ITALIC,system);
#endif
r2d_init_font_field(R2D_SMALL_PROPORTIONAL_NORMAL,proportional);
r2d_init_font_field_without_bold(R2D_SMALL_PROPORTIONAL_BOLD,proportional);
r2d_init_font_field(R2D_SMALL_PROPORTIONAL_ITALIC,proportional);
r2d_init_font_field_without_bold(R2D_SMALL_PROPORTIONAL_BOLD_ITALIC,proportional);
r2d_init_font_field(R2D_MEDIUM_PROPORTIONAL_NORMAL,proportional);
r2d_init_font_field_without_bold(R2D_MEDIUM_PROPORTIONAL_BOLD,proportional);
r2d_init_font_field(R2D_MEDIUM_PROPORTIONAL_ITALIC,proportional);
r2d_init_font_field_without_bold(R2D_MEDIUM_PROPORTIONAL_BOLD_ITALIC,proportional);
r2d_init_font_field(R2D_BIG_PROPORTIONAL_NORMAL,proportional);
r2d_init_font_field_without_bold(R2D_BIG_PROPORTIONAL_BOLD,proportional);
r2d_init_font_field(R2D_BIG_PROPORTIONAL_ITALIC,proportional);
r2d_init_font_field_without_bold(R2D_BIG_PROPORTIONAL_BOLD_ITALIC,proportional);
return(R2D_OK);
}