{"id":666,"date":"2011-10-30T18:19:10","date_gmt":"2011-10-30T11:19:10","guid":{"rendered":"http:\/\/blog.bebensiganteng.com\/?p=666"},"modified":"2016-03-14T08:17:14","modified_gmt":"2016-03-14T08:17:14","slug":"textlayoutformat-arabic-text","status":"publish","type":"post","link":"https:\/\/rahmat-hidayat.com\/?p=666","title":{"rendered":"TextLayoutFormat for Arabic Text"},"content":{"rendered":"<p><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"425\" height=\"284\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,40,0\"><param name=\"allowFullScreen\" value=\"false\" \/><param name=\"allowscriptaccess\" value=\"always\" \/><param name=\"src\" value=\" http:\/\/labs.bebensiganteng.com\/flash\/tlf\/default.swf\" \/><param name=\"allowfullscreen\" value=\"false\" \/><embed type=\"application\/x-shockwave-flash\" width=\"425\" height=\"284\" src=\" http:\/\/labs.bebensiganteng.com\/flash\/tlf\/default.swf\" allowscriptaccess=\"always\" allowfullscreen=\"false\"><\/embed><\/object><\/p>\n<p>Pretty straight forward and you can use fancy fonts as well, in the example I&#8217;ve used <em>GE SS Two Medium<\/em> font.<\/p>\n<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\n\/**\r\n* ...\r\n* @author Rahmat Hidayat\r\n*\/\r\nimport fl.text.TLFTextField;\r\nimport flashx.textLayout.formats.TextLayoutFormat;\r\nimport flashx.textLayout.elements.TextFlow;\r\nimport flash.text.TextFormat;\r\nimport flash.text.AntiAliasType;\r\nimport flash.text.FontStyle;\r\nimport flash.text.Font;\r\nimport flash.text.engine.FontLookup;\r\nimport flashx.textLayout.edit.ISelectionManager;\r\nimport flashx.textLayout.edit.EditManager;\r\nimport flashx.textLayout.edit.SelectionState;\r\nimport flashx.textLayout.formats.Direction;\r\n\r\nvar tField:TLFTextField = new TLFTextField();\r\nvar applyFont:Font = new Arabic();\r\n\r\n\/**\r\n* Things that matter\r\n*\/\r\ntField.text = &quot;\u0623\u063a\u0646\u064a\u0629 \u0644\u0634\u0639\u0628\u0648\u0644\u0627 \u0639\u0646 \u0645\u0642\u062a\u0644 \u0645\u0639\u0645\u0631 \u0627\u0644\u0642\u0630\u0627\u0641\u064a&quot;;\r\ntField.direction = Direction.RTL;\r\ntField.width = 300;\r\ntField.x = (stage.stageWidth - tField.width)\/2;\r\ntField.y = 100;\r\ntField.wordWrap = true;\r\n\r\ntField.embedFonts = true;\r\n\r\naddChild(tField)\r\n\r\nvar tFormat:TextLayoutFormat = new TextLayoutFormat();\r\ntFormat.fontFamily = applyFont.fontName;\r\ntFormat.color\t= 0xffffff;\r\ntFormat.fontLookup = FontLookup.EMBEDDED_CFF;\r\ntFormat.fontSize\t= 30;\r\n\r\n\/**\r\n*  Just blindly copy and paste the below\r\n*\/\r\n\r\ntField.textFlow.invalidateAllFormats();\r\ntField.textFlow.hostFormat = tFormat;\r\n\r\nvar prevManager:ISelectionManager = tField.textFlow.interactionManager;\r\nvar editManager:EditManager = new EditManager();\r\nvar sel:SelectionState = new SelectionState(tField.textFlow, 0, tField.text.length);\r\ntField.textFlow.interactionManager = editManager;\r\neditManager.applyLeafFormat(tFormat, sel);\r\ntField.textFlow.interactionManager = prevManager;\r\n\r\ntField.textFlow.flowComposer.updateAllControllers();\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Pretty straight forward and you can use fancy fonts as well, in the example I&#8217;ve used GE SS Two Medium font.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,9,12,25],"tags":[73,75,86,96,143],"_links":{"self":[{"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/posts\/666"}],"collection":[{"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=666"}],"version-history":[{"count":1,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/posts\/666\/revisions"}],"predecessor-version":[{"id":1632,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=\/wp\/v2\/posts\/666\/revisions\/1632"}],"wp:attachment":[{"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=666"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=666"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rahmat-hidayat.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=666"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}