AutoCAD: Arabic text with transparencies and PlotMan

May 13, 2019 | howto, PlotMan

It is not widely known, that using transparencies
in Autodesk® AutoCAD® software
makes the resulting PDF files be rasterised.

This can have unexpected results. A notable example being Arabic texts.

Original text Printing with transparencies Printing with PlotMan
الحكومي ا ل ح ك و م ي الحكومي
التعاونى ا ل ت ع ا و ن ى ﺍﻟﺘﻌﺍﻭﻧﻰ

We will explain why this happens, and how we manged to solve it in
one of our apps: PlotMan for all of our customers who can now
just use PlotMan normally to create their PDF files and not worry about this at all.

What is happening? (and why?!)

Transparencies and computers

Computer graphics are a tricky issue (we should know!).
Traditionally there are two ways of representing things: raster or pixel-wise and in vector form.

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.

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.

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.

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.

The way transparencies are handled traditionally is to assign each element a colour and a level of opacity.
Then draw the elements “bottom to top** and apply the percentage of the level of opacity as a weighted average.

That means things have to be done pixel-wise, and with texts things get tricky again.

Texts and computers

Text is easy, right? Well… Sadly no. Not for computers.

The main issue here are ligatures, in languages that use the Roman alphabet, this isn’t that much of an issue, but we do use them a lot. E.g. affinity uses a ligature to have a nicer typographical representation of ff.

In Roman alphabet-based languages, this is not much of an issue, since a lack of ligatures keeps text readable.
Languages like Arabic on the other hand don’t have this luxury.

For example: words like الحكومي or ﺍﻟﺘﻌﺍﻭﻧﻰ turn into ل ح ك و م ي or ل ت ع ا و ن ى without ligatures; which is unreadable for speakers of Arabic.

Sadly, dealing with these ligatures in a pixel-wise fashion is pretty difficult and the lovely people at Autodesk haven’t yet managed to make it work.

Which means that printing from AutoCAD with transparencies enabled removes ligatures always, and is fairly visible in languages like Arabic.

Finding a solution

What not to do

Knowing what not to do is sometimes as important as knowing what to do.

Ideas we discarded:

  • Exploding text to geometry: this works on a per-symbol basis, ignoring ligatures, which means the visual result is still wrong.
  • Generate two PDF files: 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® file and at least it doubles file processing time. It also requires implementing a special workflow to merge the resulting PDF files.
  • Importing/exporting: Autodesk® design review can do transparencies to XPS, which can in turn be converted to a rasterised PDF without losing the ligatures. This sounds alright, but it can’t be automated and is error prone.

Dive into Unicode

Unicode is an attempt to standardise text encoding and representation.
Basically, it sets the rules to how computers save and interpret text.

For Arabic we are aware of two main Unicode blocks:
Arabic and Arabic Presentations Form-B.

The latter is deprecated because it has limitations in how text is represented (it has no concept of ligatures).
But this case is precisely where it is supposed to be used.

Since it has no ligatures, it means that the visual representation is going to be the same in AutoCAD software
as in the resulting symbol-wise representation in the final PDF files.

The solution

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.

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.

plotman_arabic.png

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.

Conclusion

As you can see, even in very niche cases we are able to help our customers in simple, yet effective ways.
Give PlotMan a go and let us know how it works (or doesn’t) for you.

And if you find any hard-to-solve issues, get in touch because maybe we can help out.

0
    0
    Your Cart
    Your cart is emptyReturn to Shop