mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-24 00:54:18 +08:00
implementation of character transformation of GetGlyphsAndBreaks; fix a bug of UCharToFullSizeKana
This commit is contained in:
+1
-1
@@ -10312,7 +10312,7 @@ static inline int GUIAPI LanguageCodeFromISO639s1Code (const char* iso639_1)
|
||||
*
|
||||
* - CTR_NONE,
|
||||
* - or one of CTR_CAPITALIZE, CTR_UPPERCASE, and CTR_LOWERCASE,
|
||||
* - and OR'ed with CTR_ FULL_WIDTH and/or CTR_FULL_SIZE_KANA
|
||||
* - and OR'ed with CTR_FULL_WIDTH and/or CTR_FULL_SIZE_KANA
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
+1
-1
@@ -4798,7 +4798,7 @@ Uchar32 GUIAPI UCharToFullSizeKana (Uchar32 uc)
|
||||
int mid = TABLESIZE (kana_small_to_full_size_table) / 2;
|
||||
|
||||
if (uc < kana_small_to_full_size_table[lower].one
|
||||
|| uc < kana_small_to_full_size_table[upper].one)
|
||||
|| uc > kana_small_to_full_size_table[upper].one)
|
||||
return uc;
|
||||
|
||||
do {
|
||||
|
||||
+42
-4
@@ -1382,6 +1382,14 @@ static void dbg_dump_gbctxt(struct glyph_break_ctxt* gbctxt,
|
||||
#define dbg_dump_gbctxt(gbctxt, func, uc, gwsbo)
|
||||
#endif
|
||||
|
||||
static inline Glyph32 uc2gv(Glyph32 gv, Uchar32 uc)
|
||||
{
|
||||
if (IS_MBC_GLYPH(gv))
|
||||
return SET_MBC_GLYPH(uc);
|
||||
|
||||
return uc;
|
||||
}
|
||||
|
||||
static int gbctxt_push_back(struct glyph_break_ctxt* gbctxt,
|
||||
Glyph32 gv, Uchar32 uc, Uint8 bt, Uint16 lbo)
|
||||
{
|
||||
@@ -1452,6 +1460,39 @@ static int gbctxt_push_back(struct glyph_break_ctxt* gbctxt,
|
||||
check_sentence_breaks(gbctxt, uc, gc, gbctxt->n);
|
||||
dbg_dump_gbctxt(gbctxt, "check_sentence_breaks", uc, gwsbo);
|
||||
|
||||
// Character Transformation
|
||||
// NOTE: Assume character transformation will not affect the breaks
|
||||
if (gbctxt->ctr) {
|
||||
Uchar32 new_uc = uc;
|
||||
|
||||
switch(gbctxt->ctr & CTR_CASE_MASK) {
|
||||
case CTR_UPPERCASE:
|
||||
new_uc = UCharToUpper(uc);
|
||||
break;
|
||||
|
||||
case CTR_LOWERCASE:
|
||||
new_uc = UCharToLower(uc);
|
||||
break;
|
||||
|
||||
case CTR_CAPITALIZE:
|
||||
if (gbctxt->bos[gbctxt->n] & BOV_WB_WORD_START)
|
||||
new_uc = UCharToUpper(uc);
|
||||
break;
|
||||
}
|
||||
|
||||
if (gbctxt->ctr & CTR_FULL_WIDTH) {
|
||||
new_uc = UCharToFullWidth(new_uc);
|
||||
}
|
||||
|
||||
if (gbctxt->ctr & CTR_FULL_SIZE_KANA) {
|
||||
new_uc = UCharToFullSizeKana(new_uc);
|
||||
}
|
||||
|
||||
if (new_uc != uc) {
|
||||
gbctxt->gvs[gbctxt->n - 1] = uc2gv(gv, new_uc);
|
||||
}
|
||||
}
|
||||
|
||||
gbctxt->prev_uc = uc;
|
||||
|
||||
/* uc might not be a valid Unicode base character, but really all we
|
||||
@@ -2237,10 +2278,7 @@ int GUIAPI GetGlyphsAndBreaks(LOGFONT* logfont, const char* mstr, int mstr_len,
|
||||
// Every tab is converted to a space (U+0020).
|
||||
_DBG_PRINTF ("CSS: Every tab is converted to a space (U+0020)\n");
|
||||
uc = UCHAR_SPACE;
|
||||
if (IS_MBC_GLYPH(gv))
|
||||
gv = SET_MBC_GLYPH(UCHAR_SPACE);
|
||||
else
|
||||
gv = UCHAR_SPACE;
|
||||
gv = uc2gv(gv, uc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user