码迷,mamicode.com
首页 > 移动开发 > 详细

[修正] Firemonkey Android Edit 可输入 Emoji (颜文字)

时间:2016-11-18 23:18:43      阅读:549      评论:0      收藏:0      [点我收藏+]

标签:ons   proc   ade   one   control   procedure   and   ted   问题:   

问题:在 Android 平台下,TEdit 输入 Emoji 文字,无法显示彩色(皆为黑色),即使将 Edit.ControlType = Platform 设为平台原生控件,还是没用(真机测试 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 = $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

[修正] Firemonkey Android Edit 可输入 Emoji (颜文字)

标签:ons   proc   ade   one   control   procedure   and   ted   问题:   

原文地址:http://www.cnblogs.com/onechen/p/6079080.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!