{"id":1861,"date":"2015-01-27T23:50:27","date_gmt":"2015-01-27T15:50:27","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=1861"},"modified":"2017-09-23T10:40:36","modified_gmt":"2017-09-23T02:40:36","slug":"%e8%bd%ac%e5%9c%a8-andriod-%e7%a8%8b%e5%ba%8f%e4%b8%ad%e4%bd%bf%e7%94%a8%e8%87%aa%e5%b7%b1%e7%9a%84%e5%ad%97%e4%bd%93","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=1861","title":{"rendered":"[\u8bd1]\u5728 Andriod\/IOS \u7a0b\u5e8f\u4e2d\u4f7f\u7528\u81ea\u5df1\u7684\u5b57\u4f53"},"content":{"rendered":"<p>\u539f\u6587\u94fe\u63a5\uff1ahttp:\/\/firemonkeyblog.blogspot.com\/2014\/12\/using-custom-fonts-in-android-delphi.html<\/p>\n<p>\u4f60\u5e94\u8be5\u80fd\u591f\u5728 Andriod \u5e94\u7528\u4e2d\u4f7f\u7528\u4efb\u4f55 TrueType \u5b57\u4f53\u3002<\/p>\n<p>\u793a\u4f8b\u4f7f\u7528\u4e86\u5b57\u7b26 Script MT Bold\u3002\u8fd9\u4e2a\u5b57\u4f53\u5728 Windows \u7684\u5b57\u4f53\u6587\u4ef6\u5939\u3002\u8fd9\u4e2a\u5b57\u4f53\u7684\u6587\u4ef6\u540d\u4e3a\u00a0SCRIPTBL.TTF\u3002<\/p>\n<p>1. \u590d\u5236 SCRIPTBL.TTF \u5230\u4f60\u7684\u5de5\u7a0b\u76ee\u5f55\u3002<\/p>\n<p>2. \u5728\u53d1\u5e03\uff08Deployment\uff09\u7a97\u53e3\u4e2d\uff0c\u6dfb\u52a0 SCRIPTBL.TTF \u6587\u4ef6\u3002\u8bbe\u7f6e\u5b83\u7684\u8fdc\u7a0b\u76ee\u5f55\uff08Remote Path\uff09\u4e3a .\\assets\\internal\\<\/p>\n<p>\u8bbe\u7f6e\u8fdc\u7a0b\u540d\u79f0\uff08Remote Name\uff09\u4e3a SCRIPTBL.ttf \uff08\u4f7f\u7528\u5c0f\u5199\u7684 ttf \u6269\u5c55\u540d\u662f\u56e0\u4e3a\u6211\u4eec\u5728\u7a0b\u5e8f\u4e2d\u4f7f\u7528\u786c\u7f16\u7801\uff09<\/p>\n<p><a href=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/01\/TTF_Dep.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1862\" src=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/01\/TTF_Dep.png\" alt=\"TTF_Dep\" width=\"559\" height=\"30\" srcset=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/01\/TTF_Dep.png 559w, https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/01\/TTF_Dep-300x16.png 300w\" sizes=\"auto, (max-width: 559px) 100vw, 559px\" \/><\/a><\/p>\n<p>3. \u5728 IDE \u7f16\u8f91\u5668\u4e2d\u6253\u5f00 FMX.FontGlyphs.Android.pas\u3002\uff08\u6587\u4ef6\u4f4d\u4e8e C:\\Program Files (x86)\\Embarcadero\\Studio\\15.0\\source\\fmx\uff09<\/p>\n<p>\u5982\u679c\u5b83\u88ab\u6807\u8bb0\u4e3a\u53ea\u8bfb\uff0c\u5728\u7f16\u8f91\u5668\u4e2d\u53f3\u51fb\u5173\u95ed\u53ea\u8bfb\u3002<\/p>\n<p>\u4fdd\u5b58\u6587\u4ef6\u5230\u5de5\u7a0b\u76ee\u5f55\u3002\u4e0d\u8981\u66f4\u6539\u6587\u4ef6\u540d\u3002\u63a5\u4e0b\u6765\u4f60\u53ef\u4ee5\u5728\u7f16\u8f91\u5668\u4e2d\u4fee\u6539\u5b83\u3002<\/p>\n<p>A. \u6dfb\u52a0\u5bf9 System.IOUtils to \u7684\u5f15\u7528\u5230 uses \u90e8\u5206\u3002<\/p>\n<p>B. \u627e\u5230 procedure TAndroidFontGlyphManager.LoadResource;<\/p>\n<ul>\n<li>\u6dfb\u52a0\u4e00\u4e2a\u53d8\u91cf FontFile: string;<\/li>\n<li>\u5728\u8fc7\u7a0b\u4e2d\u6709\u4e00\u884c\u662f\uff1aTypeface := TJTypeface.JavaClass.create(FamilyName, TypefaceFlag);<\/li>\n<li>\u5c06\u4e0a\u9762\u7684\u884c\u66ff\u6362\u4e3a:<\/li>\n<\/ul>\n<pre class=\"lang:delphi decode:true \">FontFile := TPath.GetDocumentsPath + PathDelim + CurrentSettings.Family + '.ttf';\r\nif FileExists(FontFile) then\r\n   Typeface := TJTypeface.JavaClass.createFromFile(StringToJString(FontFile))\r\nelse\r\n   Typeface := TJTypeface.JavaClass.Create(FamilyName, TypefaceFlag);<\/pre>\n<p>\u8fd9\u5c06\u8ba9\u5176\u67e5\u627e\u524d\u9762\u6307\u5b9a\u540d\u79f0\u7684\u5b57\u4f53\u6587\u4ef6\u3002<\/p>\n<p>4. \u5bf9\u4e8e\u6bcf\u4e00\u4e2a\u60f3\u4f7f\u7528\u8be5\u5b57\u4f53\u7684\u7ec4\u4ef6\uff0c\u8bbe\u7f6e \u00a0TextSettings \u7684\u5b57\u4f53\u5bb6\u65cf\uff08FontFamily\uff09\u5c5e\u6027\u4e3a SCRIPTBL<\/p>\n<p>\u8fd9\u4e2a\u540d\u79f0\u662f\u4e0d\u5305\u542b\u6269\u5c55\u540d\u7684\u5b57\u4f53\u6587\u4ef6\u540d\u79f0\u3002\u4e0d\u8981\u8bbe\u7f6e\u4e3a &#8220;SCRIPTBL.ttf&#8221; \u6216 &#8220;Script MT Bold&#8221;\u3002<\/p>\n<p>\u4f60\u5c06\u4e0d\u5f97\u4e0d\u624b\u52a8\u8f93\u5165\u6216\u7c98\u8d34\u5b83\u5230\u5c5e\u6027\u7f16\u8f91\u6846\u3002<\/p>\n<p>\u6ce8\u610f: \u5728 Android \u91cc\u6587\u4ef6\u540d\u533a\u5206\u5927\u5c0f\u5199\uff0c\u6240\u4ee5\u4f60\u5fc5\u9700\u4fdd\u8bc1\u4ed6\u4eec\u4e00\u81f4\u3002<\/p>\n<p>\u8fd9\u4e2a\u7a97\u4f53\u5305\u62ec label, textbox, memo, checkbox, radio button:<\/p>\n<p><a href=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/01\/TTF_Result.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1863\" src=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/01\/TTF_Result.png\" alt=\"TTF_Result\" width=\"505\" height=\"712\" srcset=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/01\/TTF_Result.png 505w, https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/01\/TTF_Result-213x300.png 213w\" sizes=\"auto, (max-width: 505px) 100vw, 505px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u539f\u4f5c\u8005\u8fd8\u6709\u4e00\u7bc7\u6587\u7ae0\u63cf\u8ff0\u4e86\u5982\u4f55\u5728 iOS \u4e2d\u4f7f\u7528\u81ea\u5df1\u7684 TTF \u5b57\u4f53\uff0c\u548c\u4e0a\u9762\u7684\u5dee\u522b\u5728\u4e8e\uff1a<\/p>\n<p>1\u3001\u5728 IDE \u7684\u7f16\u8f91\u5668\u4e2d\u6253\u5f00\u00a0info.plist \u6587\u4ef6\uff0c\u5c06\u5b83\u547d\u540d\u4e3a custom.info.plist \u5e76\u4fdd\u5b58\u5230\u5de5\u7a0b\u76ee\u5f55\u3002<\/p>\n<p>\u6dfb\u52a0\u4e00\u4e2a key\u00a0:<\/p>\n<pre class=\"lang:delphi decode:true prettyprint xml \"> &lt;key&gt;UIAppFonts&lt;\/key&gt;\r\n &lt;array&gt;\r\n &lt;string&gt;SCRIPTBL.TTF&lt;\/string&gt;\r\n &lt;\/array&gt;<\/pre>\n<p>\u8fd9\u5c06\u544a\u8bc9 IOS \u80fd\u591f\u4f7f\u7528\u989d\u5916\u7684\u5b57\u4f53\u6587\u4ef6\u3002IOS\u5c06\u81ea\u52a8\u5bfb\u627e\u5b83\u3002<\/p>\n<p>2\u3001\u53d1\u5e03\u9875\u4e2d\u7684\u8fdc\u7a0b\u76ee\u5f55\u8bbe\u7f6e\u4e3a \u201c.\\\u201d<\/p>\n<p>3\u3001\u5c06\u7b2c\u4e00\u6b65\u7684custom.info.plist \u6587\u4ef6\u52a0\u5165\u5230\u53d1\u5e03\u9875\u4e2d\uff0c\u5e76\u91cd\u547d\u540d\u4e3a info.plist\uff0c\u7136\u540e\u53bb\u6389\u539f\u6765\u7684 info.plist \u7684\u9009\u62e9\u3002<\/p>\n<p>4\u3001\u4e2d\u6587\u5b57\u4f53\u8981\u4f7f\u7528\u5b83\u7684\u9ed8\u8ba4\u540d\u79f0\uff0c\u4e5f\u5c31\u662f\u82f1\u6587\u540d\u79f0\uff0c\u4e0d\u80fd\u4f7f\u7528\u4e2d\u6587\u540d\u79f0\u3002<\/p>\n<p>\u5176\u5b83\u7684\u5c31\u4e00\u6837\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u94fe\u63a5\uff1ahttp:\/\/firemonk [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[69,8,21],"tags":[149,301,302],"class_list":["post-1861","post","type-post","status-publish","format-standard","hentry","category-c-builder","category-delphi","category-misc","tag-fmx","tag-ttf","tag-302"],"views":5523,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1861","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1861"}],"version-history":[{"count":7,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1861\/revisions"}],"predecessor-version":[{"id":4700,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1861\/revisions\/4700"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1861"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1861"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1861"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}