2013年4月24日 星期三

BREW 3.1.5 OEM Font


The BREW System using IFont Interface to Draw Text/Chars internal. Actually, It is used by IDisplay_DrawText.
The important concept is, two type font: Logical Font & Physical Font.


1)The Logical Font is as :
// Logical font type
enum {
AEE_FONT_NORMAL=0x8000,
AEE_FONT_BOLD,
AEE_FONT_LARGE,
AEE_FONT_ITALIC,
AEE_FONT_BOLD_ITALIC,
AEE_FONT_LARGE_ITALIC,
AEE_FONT_NORMAL_SCH,
AEE_FONT_USER_1,
AEE_FONT_USER_2,
AEE_FONT_TOTAL
};



2)The Phisical Font is The detail implemented IFont Interface
For, IDisplay, It will associate one logical font type with one phisical font instance. And When you Call IDisplay_DrawText, passed the logical font type, IDisplay inside will using the associated IFont instance to draw chars, such as IFONT_DrawText.


Now, I give the basic flow for BREW Font management:
When BREW Init, BREW will create some system Font instance(physical Font) with such as 
AEECLSID_FONTSYSNORMAL,
AEECLSID_FONTSYSLARGE,
AEECLSID_FONTSYSBOLD, 
And Call IDISPLAY_SetFont to associate them with logical font type:
 AEE_FONT_NORMAL,
AEE_FONT_LARGE,
AEE_FONT_BOLD
Then, When App Call IDISPLAY_DrawText, and passed logical font type, BREW will using the related IFont instance to draw chars.
If App want to change the default physical font, Then, Developer can implement their own IFont Interface. Create this IFont instance in run-time, Then Call IDisplay_SetFont, Passed this IFont Instance and the logical font type which you want to associated, assume, AEE_FONT_BOLD . 
OK, from now on, When you using IDisplay_Drawtext with AEE_FONT_BOLD , BREW will use your own IFont instance to draw the text.


修改自己的FONT三種方法
1)使用BREW Font Extension
2)從底層OEM層修改AEECLSID_FONTSYSNORMAL, AEECLSID_FONTSYSLARGE, AEECLSID_FONTSYSBOLD
3)在程式內撰寫IDisplay_SetFont