{"id":306,"date":"2010-05-23T06:08:15","date_gmt":"2010-05-23T04:08:15","guid":{"rendered":"http:\/\/ixdc.net\/blog\/?p=306"},"modified":"2018-05-08T22:26:51","modified_gmt":"2018-05-08T20:26:51","slug":"actionscript-2-0-arabic-parsing-v1-3","status":"publish","type":"post","link":"https:\/\/ixdc.net\/blog\/2010\/05\/23\/actionscript-2-0-arabic-parsing-v1-3\/","title":{"rendered":"ActionScript 2.0 Arabic Parsing v1.3"},"content":{"rendered":"<p><strong>Update:<\/strong> a newer version available <a href=\"https:\/\/ixdc.net\/arabic\" target=\"_self\"><span style=\"color: #EF6596;\">here<\/span><\/a><\/p>\n<p>This is a bit late, my apologies to you all, yet again, thanks to <a href=\"https:\/\/blog.janjonas.net\/2010-03-25\/actionscript-2-dynamic-textfield-arabic-text\" target=\"_blank\"><span style=\"color: #EF6596;\">Jan Jonas<\/span><\/a> and Yasmin <i>(geekgirl)<\/i><br \/>\nI tried my best to solve bi-directional issues, it took me sometime to re-construct the wrapping part using completely different approach, it seems to be good when embedding fonts, but more wrapping issues pops-up for non-embedded fonts and only on Mac! this is weird, the whole solution was to solve Arabic ligatures when embedding Arabic fonts!<br \/>\nIn addition, an overall code review has been taken care of, a lot of modifications in several places throughout the code has been done, if you like this one then you can start from hear instead, but if you don&#8217;t I think I need to know \ud83d\ude09<br \/>\nAnyways, this is exactly why I released my solution as open-source from the first place, what good of a solution without sharing it with others to contribute, may be you&#8217;ll have better luck than I did when you update this one yourself ..<\/p>\n<blockquote><p>\n  <i>ActionSctipt 2.0 version available <a href=\"https:\/\/ixdc.net\/blog\/wp-content\/uploads\/2010\/05\/arabic_as2_v1.3\/parsearabic_as2_v1.3.zip\" target=\"_self\"><span style=\"color: #EF6596;\">here<\/span><\/a><\/i><br \/>\n  <i>ActionSctipt 3.0 version available <a href=\"https:\/\/ixdc.net\/blog\/wp-content\/uploads\/2010\/05\/arabic_as3_v1.3\/parsearabic_as3_v1.3.zip\" target=\"_self\"><span style=\"color: #EF6596;\">here<\/span><\/a><\/i><br \/>\n<\/blockquote\n\n<em>Requirements:<\/em><\/p>\n<ol>\n<li>Dynamic TextField<\/li>\n<li>HTML Enabled TextField<\/li>\n<li>Pre-Assigned TextFormat<\/li>\n<li>Arabic Font<\/li>\n<\/ol>\n<p><em>Features Supported:<\/em><\/p>\n<ol>\n<li> Embedding Fonts (just put a dynamic textfield on-stage and select at least Basic Latin (95 glyphs) and Arabic (1088 glyphs) from the Character Embedding menu).<\/li>\n<li>Arabic Ligatures.<\/li>\n<li>Word Wrapping.<\/li>\n<li>Bi-Directional text.<\/li>\n<li>HTML Text.<\/li>\n<li>Loading External text on run-time.<\/li>\n<li>Windows\/Mac\/Linux support.<\/li>\n<li>Arabic enabled input fields using actionscript method (createArabicInput) with the help of javascript (arabicinput.js) <i>beta<\/i><\/li>\n<\/ol>\n<p><em>Properties:<\/em><\/p>\n<ol>\n<li>For matching\/comparing input string, when referencing original input string use the data property (utils.data) instead of (TextField.text) where &#8220;utils&#8221; is an instance of StringUtils class.<\/li>\n<\/ol>\n<p><em>Features Not Supported:<\/em><\/p>\n<ol>\n<li> Arabic Diacritics.<\/li>\n<\/ol>\n<p><em>Change List:<\/em><\/p>\n<ol>\n<li>New approach for wrapping text properly involving HTML tags, brackets, punctuation marks and bi-directional cases.<\/li>\n<li>Looping through input string thoroughly only once for better performance.<\/li>\n<li>Object class model structure with public properties and methods instead of static parser.<\/li>\n<\/ol>\n<p><em>Fixed Bugs:<\/em><\/p>\n<ol>\n<li>Arabic character condition for letter (?).<\/li>\n<li>Beginning and ending text lines with non-Arabic characters (Embedding fonts required for Mac).<\/li>\n<li>Inline HTML tags (Embedding fonts required for Mac).<\/li>\n<li>Symmetrical swapping for bi-directional brackets.<\/li>\n<\/ol>\n<p><em>Known Bugs:<\/em><\/p>\n<ol>\n<li>improper wrapping for non-embedded fonts only on Mac when begin text line with non-Arabic characters or when using custom format HTML tags.<\/li>\n<\/ol>\n<p>Here is an example works with <a href=\"https:\/\/ixdc.net\/blog\/wp-content\/uploads\/2010\/05\/arabic_as2_v1.3\/arabic.xml\" target=\"_blank\"><span style=\"color: #EF6596;\">this<\/span><\/a> external XML file <i>(with run-time resizing vs. wrapping)<\/i>:<\/p>\n<p><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"500\" height=\"300\" codebase=\"https:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,40,0\"><param name=\"scale\" value=\"noscale\" \/><param name=\"base\" value=\"https:\/\/ixdc.net\/blog\/wp-content\/uploads\/2010\/05\/arabic_as2_v1.3\/\" \/><param name=\"src\" value=\"https:\/\/ixdc.net\/blog\/wp-content\/uploads\/2010\/05\/arabic_as2_v1.3\/arabic.swf\" \/><embed type=\"application\/x-shockwave-flash\" width=\"500\" height=\"300\" src=\"https:\/\/ixdc.net\/blog\/wp-content\/uploads\/2010\/05\/arabic_as2_v1.3\/arabic.swf\" base=\"https:\/\/ixdc.net\/blog\/wp-content\/uploads\/2010\/05\/arabic_as2_v1.3\/\" scale=\"noscale\"><\/embed><\/object><br \/>\n<em>download the above example <a href=\"https:\/\/ixdc.net\/blog\/wp-content\/uploads\/2010\/05\/arabic_as2_v1.3\/arabic_as2_v1.3.zip\" target=\"_blank\"><span style=\"color: #EF6596;\">here<\/span><\/a><\/em><\/p>\n<p>Well, still not perfect, for some reason I feel that a tiny code snippet can do all the magic to contain the mac issues with non-embedded fonts, just can&#8217;t find that one &#8230; yet!<\/p>\n<p><i>Test files are available <a href=\"https:\/\/ixdc.net\/blog\/wp-content\/uploads\/2010\/05\/arabic_as2_v1.3\/asunit_as2_v1.3.zip\" target=\"_blank\"><span style=\"color: #EF6596;\">here<\/span><\/a> using <a href=\"https:\/\/asunit.org\/\" target=\"_blank\"><span style=\"color: #EF6596;\">ASUnit<\/span><\/a> Framework<\/i><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update: a newer version available here This is a bit late, my apologies to you all, yet again, thanks to Jan Jonas and Yasmin (geekgirl) I tried my best to solve bi-directional issues, it took me sometime to re-construct the wrapping part using completely different approach, it seems to be good when embedding fonts, but [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38,42],"tags":[3,34,36,37,5],"class_list":["post-306","post","type-post","status-publish","format-standard","hentry","category-38","category-may","tag-actionscript","tag-arabic","tag-as2","tag-as3","tag-flash"],"_links":{"self":[{"href":"https:\/\/ixdc.net\/blog\/wp-json\/wp\/v2\/posts\/306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixdc.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixdc.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixdc.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ixdc.net\/blog\/wp-json\/wp\/v2\/comments?post=306"}],"version-history":[{"count":1,"href":"https:\/\/ixdc.net\/blog\/wp-json\/wp\/v2\/posts\/306\/revisions"}],"predecessor-version":[{"id":1246,"href":"https:\/\/ixdc.net\/blog\/wp-json\/wp\/v2\/posts\/306\/revisions\/1246"}],"wp:attachment":[{"href":"https:\/\/ixdc.net\/blog\/wp-json\/wp\/v2\/media?parent=306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixdc.net\/blog\/wp-json\/wp\/v2\/categories?post=306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixdc.net\/blog\/wp-json\/wp\/v2\/tags?post=306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}