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





2013年4月11日 星期四

BREW IDatabase IDBMgr IDBRecord


1. create a IDBMgr object
-->ISHELL_CreateInstance( .... AEECLSID_DBMGR ... )

2. open database
--> IDatabase IDBMGR_OpenDatabase(......)

once database is open, IDBMgr is not longer needed
-->IDBMGR_Release(....)

3. Create Record
init AEEDBField
--> set fType, fName, wDataLen, pBuffer
--> IDATABASE_CreateRecord( .... AEEDBField ....)

4. Record Reset, Update, Delete, Get


Simplifying Access to BREW Databases


以下是官方資料

The IDatabase Interface functions allow you to create and access records in databases created and opened with the IDBMgr Interface.

1.
To obtain an instance of the IDatabase Interface , you call IDBMGR_OpenDatabase() to open the desired database.

You then use the IDatabase Interface pointer returned by this function to access the database with the operations described below.

2.
You can also use functions in the IDBRecord Interface to access the fields of individual database records.

3.
When you have completed access to the database, you call IDATABASE_Release() to close it.

4.
The IDATABASE_CreateRecord() function creates a new record and adds it to your database (the function IDBRECORD_Remove() is used to remove a record from the database). Each record contains one or more fields.

5.

Each field is defined by the AEEDBField structure, which includes the following elements:
  • The field name is a descriptor of the field's contents, (name, phone number, email address, etc.) The AEEDBFieldName enumerated type contains constants for commonly used field names.
  • The field type gives the data type of the field (byte, word, double-word, character string, binary, phone number or bitmap).
  • The field buffer pointer is a pointer to the actual contents of the field.
  • The field length is the length in bytes of the field contents.  







2013年4月2日 星期二

BREW Using bitmap fonts, How to use AEE_FONT_USER_1/AEE_FONT_USER_2 ?

This example shows how an application uses bitmap fonts to display text.

How to use AEE_FONT_USER_1/AEE_FONT_USER_2 ?

簡單來說BREW DrawText Font不只有這些而已
AEEFont:
Description
This ENUM specifies the logical font type used in IDisplay text drawing operations.

enum {
   AEE_FONT_NORMAL=0x8000,
   AEE_FONT_BOLD,
   AEE_FONT_LARGE,
   AEE_FONT_ITALIC,
   AEE_FONT_BOLD_ITALIC,
   AEE_FONT_LARGE_ITALIC,
   AEE_FONT_USER_1,
   AEE_FONT_USER_2,
   AEE_FONT_TOTAL
};

可以利用
  • AEECLSID_FONT_STANDARD11
  • AEECLSID_FONT_STANDARD11B
  • AEECLSID_FONT_STANDARD15
  • AEECLSID_FONT_STANDARD15B
  • AEECLSID_FONT_STANDARD18
  • AEECLSID_FONT_STANDARD18B
  • AEECLSID_FONT_STANDARD23
  • AEECLSID_FONT_STANDARD23B
  • AEECLSID_FONT_STANDARD26
  • AEECLSID_FONT_STANDARD26B
  • AEECLSID_FONT_STANDARD36
  • 
    怎麼利用呢?How to use this?
    
    
    1.建立Instance
    
    ISHELL_CreateInstance(me->piShell, AEECLSID_FONT_STANDARD11, (void**)&piFontUser1); 
    
    
    2.在Drawtext之前setFont
    
    IDisplay_SetFont(me->piDisplay, AEE_FONT_USER_1, piFontUser1);  
    
    
    3.Draw
    
    IDISPLAY_DrawText(pMe -> a.m_pIDisplay,
                                       AEE_FONT_USER_1,
                                         hello, 
                                        -1 , 
                                          0 , 
                                        0 , 
                                        NULL, IDF_ALIGN_CENTER );
    
    
    
    
    大功告成
    
    
    :)