{"id":2139,"date":"2019-05-13T08:00:00","date_gmt":"2019-05-13T07:00:00","guid":{"rendered":"https:\/\/camilion.dms3labs.cat\/2019\/05\/13\/autocad-arabic-text-with-transparencies-and-plotman\/"},"modified":"2024-02-14T17:02:00","modified_gmt":"2024-02-14T16:02:00","slug":"autocad-arabic-text-with-transparencies-and-plotman","status":"publish","type":"post","link":"https:\/\/camilion.eu\/es\/2019\/05\/13\/autocad-arabic-text-with-transparencies-and-plotman\/","title":{"rendered":"AutoCAD: Arabic text with transparencies and PlotMan"},"content":{"rendered":"<p>It is not widely known, that using transparencies<br \/>\nin <a href=\"https:\/\/autodesk.com\" target=\"_blank\" rel=\"noopener\">Autodesk\u00ae<\/a> <a href=\"https:\/\/www.autodesk.com\/products\/autocad\/overview\" target=\"_blank\" rel=\"noopener\">AutoCAD\u00ae<\/a> software<br \/>\nmakes the resulting PDF files be rasterised.<\/p>\n<p>This can have unexpected results. A notable example being Arabic texts.<\/p>\n<table>\n<thead>\n<tr>\n<th>Original text<\/th>\n<th>Printing with transparencies<\/th>\n<th>Printing with <a href=\"https:\/\/camilion.eu\/en\/apps\/PlotMan\/\">PlotMan<\/a><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u0627\u0644\u062d\u0643\u0648\u0645\u064a<\/td>\n<td>\u0627 \u0644 \u062d \u0643 \u0648 \u0645 \u064a<\/td>\n<td>\u0627\u0644\u062d\u0643\u0648\u0645\u064a<\/td>\n<\/tr>\n<tr>\n<td>\u0627\u0644\u062a\u0639\u0627\u0648\u0646\u0649<\/td>\n<td>\u0627 \u0644 \u062a \u0639 \u0627 \u0648 \u0646 \u0649<\/td>\n<td>\ufe8d\ufedf\ufe98\ufecc\ufe8d\ufeed\ufee7\ufef0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>We will explain why this happens, and how we manged to solve it in<br \/>\n<a href=\"https:\/\/camilion.eu\/en\/apps\/\">one of our apps<\/a>: <a href=\"https:\/\/camilion.eu\/en\/apps\/PlotMan\/\">PlotMan<\/a> for all of our customers who can now<br \/>\njust use <a href=\"https:\/\/camilion.eu\/en\/apps\/PlotMan\/\">PlotMan<\/a> normally to create their PDF files and not worry about this at all.<\/p>\n<div class=\"toc\">\n<ul>\n<li><a href=\"#what-is-happening-and-why\">What is happening? (and why?!)<\/a>\n<ul>\n<li><a href=\"#transparencies-and-computers\">Transparencies and computers<\/a><\/li>\n<li><a href=\"#texts-and-computers\">Texts and computers<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#finding-a-solution\">Finding a solution<\/a>\n<ul>\n<li><a href=\"#what-not-to-do\">What not to do<\/a><\/li>\n<li><a href=\"#dive-into-unicode\">Dive into Unicode<\/a><\/li>\n<li><a href=\"#the-solution\">The solution<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#conclusion\">Conclusion<\/a><\/li>\n<\/ul>\n<\/div>\n<h2 id=\"what-is-happening-and-why\">What is happening? (and why?!)<\/h2>\n<h3 id=\"transparencies-and-computers\">Transparencies and computers<\/h3>\n<p>Computer graphics are a tricky issue (we should know!).<br \/>\nTraditionally there are two ways of representing things: raster or pixel-wise and in vector form.<\/p>\n<p>Raster or pixel-wise means that in order to represent a line, we save the colour of all pixels (or squares) where the line passes through.<\/p>\n<p>The latter means that we only save the starting point, the end point and the colour, which allows us to derive the pixel-wise data.<\/p>\n<p>Clearly vector form graphics are more accurate and require less storage, but in order to represent graphics on a screen, or on paper (even digital like PDF), we sometimes need to rasterise or convert data to pixels.<\/p>\n<p>This is the case with transparencies, which are not fully supported in PDF files or by printers, and certainly not in all cases where AutoCAD software can use them.<\/p>\n<p>The way transparencies are handled traditionally is to assign each element a colour and a level of opacity.<br \/>\nThen draw the elements &ldquo;bottom to top** and apply the percentage of the level of opacity as a weighted average.<\/p>\n<p>That means things have to be done pixel-wise, and with texts things get tricky again.<\/p>\n<h3 id=\"texts-and-computers\">Texts and computers<\/h3>\n<p>Text is easy, right? Well&hellip; Sadly no. Not for computers.<\/p>\n<p>The main issue here are <a href=\"https:\/\/en.wikipedia.org\/wiki\/Orthographic_ligature\" target=\"_blank\" rel=\"noopener\">ligatures<\/a>, in languages that use the Roman alphabet, this isn&rsquo;t that much of an issue, but we do use them a lot. E.g. a<strong>ff<\/strong>inity uses a ligature to have a nicer typographical representation of <code>ff<\/code>.<\/p>\n<p>In Roman alphabet-based languages, this is not much of an issue, since a lack of ligatures keeps text readable.<br \/>\nLanguages like Arabic on the other hand don&rsquo;t have this luxury.<\/p>\n<p>For example: words like  \u0627\u0644\u062d\u0643\u0648\u0645\u064a or \ufe8d\ufedf\ufe98\ufecc\ufe8d\ufeed\ufee7\ufef0 turn into  \u0644 \u062d \u0643 \u0648 \u0645 \u064a or  \u0644 \u062a \u0639 \u0627 \u0648 \u0646 \u0649 without ligatures; which is unreadable for speakers of Arabic.<\/p>\n<p>Sadly, dealing with these ligatures in a pixel-wise fashion is pretty difficult and the lovely people at <a href=\"https:\/\/autodesk.com\" target=\"_blank\" rel=\"noopener\">Autodesk<\/a> haven&rsquo;t yet managed to make it work.<\/p>\n<p>Which means that printing from <a href=\"https:\/\/www.autodesk.com\/products\/autocad\/overview\" target=\"_blank\" rel=\"noopener\">AutoCAD<\/a> with transparencies enabled removes ligatures always, and is fairly visible in languages like Arabic.<\/p>\n<h2 id=\"finding-a-solution\">Finding a solution<\/h2>\n<h3 id=\"what-not-to-do\">What <strong>not<\/strong> to do<\/h3>\n<p>Knowing <em>what not<\/em> to do is sometimes as important as knowing <em>what<\/em> to do.<\/p>\n<p>Ideas we discarded:<\/p>\n<ul>\n<li><strong>Exploding text to geometry<\/strong>: this works on a per-symbol basis, ignoring ligatures, which means the visual result is still wrong.<\/li>\n<li><strong>Generate two PDF files<\/strong>: one with texts, one without texts. Assuming text goes above everything else, this might be an interesting approach. However it is not elegant, requires heavy pre-processing of each DWG\u00ae file and at least it doubles file processing time. It also requires implementing a special workflow to merge the resulting PDF files.<\/li>\n<li><strong>Importing\/exporting<\/strong>: Autodesk\u00ae design review can do transparencies to XPS, which can in turn be converted to a rasterised PDF <em>without<\/em> losing the ligatures. This sounds alright, but it can&rsquo;t be automated and is error prone.<\/li>\n<\/ul>\n<h3 id=\"dive-into-unicode\">Dive into <a href=\"https:\/\/www.unicode.org\" target=\"_blank\" rel=\"noopener\">Unicode<\/a><\/h3>\n<p><a href=\"https:\/\/www.unicode.org\" target=\"_blank\" rel=\"noopener\">Unicode<\/a> is an attempt to standardise text encoding and representation.<br \/>\nBasically, it sets the rules to how computers save and interpret text.<\/p>\n<p>For Arabic we are aware of two main <a href=\"https:\/\/www.unicode.org\" target=\"_blank\" rel=\"noopener\">Unicode<\/a> blocks:<br \/>\n<a href=\"https:\/\/www.unicode.org\/charts\/PDF\/U0600.pdf\" target=\"_blank\" rel=\"noopener\">Arabic<\/a> and <a href=\"https:\/\/www.unicode.org\/charts\/PDF\/UFE70.pdf\" target=\"_blank\" rel=\"noopener\">Arabic Presentations Form-B<\/a>.<\/p>\n<p>The latter is deprecated because it has limitations in how text is represented (it has no concept of ligatures).<br \/>\nBut this case is precisely where it is supposed to be used.<\/p>\n<p>Since it has no ligatures, it means that the visual representation is going to be the same in AutoCAD software<br \/>\nas in the resulting symbol-wise representation in the final PDF files.<\/p>\n<h3 id=\"the-solution\">The solution<\/h3>\n<p>Before converting each DWG file to PDF, we convert seamlessly and without user interaction any Arabic text from its standard representation to the Arabic Presentations Form-B representation.<\/p>\n<p>And after producing the PDF, we rollback any changes to the DWG file, so that users can benefit from the simpler input in the standard representation.<\/p>\n<p><img decoding=\"async\" alt=\"plotman_arabic.png\" src=\"https:\/\/camilion.eu\/wp-content\/uploads\/2024\/02\/plotman_arabic.png\" title=\"\"><\/p>\n<p>This setting is enabled automatically whenever transparencies are enabled and Arabic text is detected and it affects any loaded external references, so there is no need for any user action.<\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>As you can see, even in very niche cases we are able to help our customers in simple, yet effective ways.<br \/>\nGive <a href=\"https:\/\/camilion.eu\/en\/apps\/PlotMan\/\">PlotMan<\/a> a go and let us know how it works (or doesn&rsquo;t) for you.<\/p>\n<p>And if you find any hard-to-solve issues, <a href=\"mailto:contact@camilion.eu\">get in touch<\/a> because maybe we can help out.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is not widely known, that using transparencies<br \/>\nin <a href=\"https:\/\/autodesk.com\">Autodesk\u00ae<\/a> <a href=\"https:\/\/www.autodesk.com\/products\/autocad\/overview\">AutoCAD\u00ae<\/a> software<br \/>\nmakes the resulting PDF files be rasterised.<\/p>\n<p>This can have unexpected results. A notable example being Arabic texts.<\/p>\n<table>\n<thead>\n<tr>\n<th>Original text<\/th>\n<th>Printing with transparencies<\/th>\n<th>Printing with <a href=\"https:\/\/camilion.eu\/en\/apps\/PlotMan\/\">PlotMan<\/a><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u0627\u0644\u062d\u0643\u0648\u0645\u064a<\/td>\n<td>\u0627 \u0644 \u062d \u0643 \u0648 \u0645 \u064a<\/td>\n<td>\u0627\u0644\u062d\u0643\u0648\u0645\u064a<\/td>\n<\/tr>\n<tr>\n<td>\u0627\u0644\u062a\u0639\u0627\u0648\u0646\u0649<\/td>\n<td>\u0627 \u0644 \u062a \u0639 \u0627 \u0648 \u0646 \u0649<\/td>\n<td>\ufe8d\ufedf\ufe98\ufecc\ufe8d\ufeed\ufee7\ufef0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>We will explain why this happens, and how we manged to solve it in<br \/>\n<a href=\"https:\/\/camilion.eu\/en\/apps\/\">one of our apps<\/a>: <a href=\"https:\/\/camilion.eu\/en\/apps\/PlotMan\/\">PlotMan<\/a> for all of our customers who can now<br \/>\njust use <a href=\"https:\/\/camilion.eu\/en\/apps\/PlotMan\/\">PlotMan<\/a> normally to create their PDF files and not worry about this at all.<\/p>\n","protected":false},"author":1,"featured_media":1446,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[192,162],"tags":[],"dipi_cpt_category":[],"class_list":["post-2139","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howto-es","category-plotman-es"],"acf":[],"_links":{"self":[{"href":"https:\/\/camilion.eu\/es\/wp-json\/wp\/v2\/posts\/2139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/camilion.eu\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/camilion.eu\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/camilion.eu\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/camilion.eu\/es\/wp-json\/wp\/v2\/comments?post=2139"}],"version-history":[{"count":3,"href":"https:\/\/camilion.eu\/es\/wp-json\/wp\/v2\/posts\/2139\/revisions"}],"predecessor-version":[{"id":2201,"href":"https:\/\/camilion.eu\/es\/wp-json\/wp\/v2\/posts\/2139\/revisions\/2201"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/camilion.eu\/es\/wp-json\/wp\/v2\/media\/1446"}],"wp:attachment":[{"href":"https:\/\/camilion.eu\/es\/wp-json\/wp\/v2\/media?parent=2139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/camilion.eu\/es\/wp-json\/wp\/v2\/categories?post=2139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/camilion.eu\/es\/wp-json\/wp\/v2\/tags?post=2139"},{"taxonomy":"dipi_cpt_category","embeddable":true,"href":"https:\/\/camilion.eu\/es\/wp-json\/wp\/v2\/dipi_cpt_category?post=2139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}