問題:在 Android 平臺下,顯示 Emoji 文字,無法顯示彩色(皆為黑色),例如 Edit 控制項,即使將 Edit.ControlType = Platform 設為平臺原生控制項,還是沒用(真機測試 Edit.ControlType 設定為 Style 與 Platform 是一樣的,而 i ...
問題:在 Android 平臺下,顯示 Emoji 文字,無法顯示彩色(皆為黑色),例如 Edit 控制項,即使將 Edit.ControlType = Platform 設為平臺原生控制項,還是沒用(真機測試 Edit.ControlType 設定為 Style 與 Platform 是一樣的,而 iOS 平臺則不同)。
修正方法:
請將源碼 FMX.TextLayout.GPU.pas 複製到自己的工程目錄里,再進行修改。
procedure TTextLayoutNG.DoDrawLayout(const ACanvas: TCanvas); var
...略... {+++>}Char: UCS4Char; // 加入此行代碼 by Aone (2016.11.18) begin ...略... for K := 0 to LRun.Chars.Count - 1 do begin {+++>} Char := LRun.Chars[K]; // 加入此行代碼 by Aone (2016.11.18) Rec := AddOrGetChar(ACanvas, LRun.Chars[K], CharDic, LRun.Font); ...略... {---> ColoredGlyph := TFontGlyphStyle.ColorGlyph in Rec.Glyph.Style; // 刪除此代碼 {+++>} // 加下下列代碼 by Aone (2016.11.18),取自: FMX.FontGlyphs.iOS ColoredGlyph := (Char = $10086)or
(Char = $1F004) or (Char = $1F0CF) or (Char = $1F170) or (Char = $1F171) or (Char = $1F17E) or (Char = $1F17F) or (Char = $1F18F) or ((Char >= $1F191) and (Char <= $1F19A)) or (Char = $1F201) or (Char = $1F202) or (Char = $1F21A) or (Char = $1F22F) or ((Char >= $1F232) and (Char <= $1F23A)) or (Char = $1F250) or (Char = $1F251) or ((Char >= $1F300) and (Char <= $1F320)) or ((Char >= $1F330) and (Char <= $1F393)) or ((Char >= $1F3A0) and (Char <= $1F3F0)) or ((Char >= $1F400) and (Char <= $1F43E)) or (Char = $1F440) or ((Char >= $1F442) and (Char <= $1F49F)) or ((Char >= $1F4A0) and (Char <= $1F4FC)) or ((Char >= $1F500) and (Char <= $1F53D)) or ((Char >= $1F550) and (Char <= $1F567)) or ((Char >= $1F5FB) and (Char <= $1F64F)) or ((Char >= $1F680) and (Char <= $1F6C5)) or (Char = $2139) or ((Char >= $2194) and (Char <= $2199)) or (Char = $21A9) or (Char = $21AA) or (Char = $231A) or (Char = $231B) or ((Char >= $23E9) and (Char <= $23EC)) or (Char = $23F0) or (Char = $23F3) or (Char = $24C2) or (Char = $25AA) or (Char = $25AB) or (Char = $25B6) or (Char = $25C0) or ((Char >= $25FB) and (Char <= $25FE)) or (Char = $2600) or (Char = $2601) or (Char = $260E) or (Char = $2611) or (Char = $2614) or (Char = $2615) or (Char = $261D) or (Char = $263A) or ((Char >= $2648) and (Char <= $2653)) or (Char = $2660) or (Char = $2663) or (Char = $2665) or (Char = $2666) or (Char = $2668) or (Char = $267B) or (Char = $267F) or (Char = $2693) or (Char = $26A0) or (Char = $26A1) or (Char = $26AA) or (Char = $26AB) or (Char = $26BD) or (Char = $26BE) or (Char = $26C4) or (Char = $26C5) or (Char = $26CE) or (Char = $26D4) or (Char = $26EA) or (Char = $26F2) or (Char = $26F3) or (Char = $26F5) or (Char = $26FA) or (Char = $26FD) or (Char = $2702) or (Char = $2705) or ((Char >= $2708) and (Char <= $270F)) or (Char = $2712) or (Char = $2714) or (Char = $2716) or (Char = $2728) or (Char = $2733) or (Char = $2734) or (Char = $2744) or (Char = $2747) or (Char = $274C) or (Char = $274E) or ((Char >= $2753) and (Char <= $2755)) or (Char = $2757) or (Char = $2764) or ((Char >= $2795) and (Char = $2797)) or (Char = $27B0) or (Char = $27BF) or (Char = $2934) or (Char = $2935) or ((Char >= $2B05) and (Char = $2B07)) or (Char = $2B1B) or (Char = $2B1C) or (Char = $2B50) or (Char = $2B55) or (Char = $3030) or (Char = $303D) or (Char = $3297) or (Char = $3299); {<+++} ...略... end;
效果:
官方相關 QC:
https://quality.embarcadero.com/browse/RSP-9899