Question

Some Background here: I've downloaded this example and made it run on my Ubuntu. Everything's fine. I put my own OpenType font into the project and it works fine too! I made sure that HarfBuzz supports my font and my language.Now I need to go further.

I need some guide here:

  1. In the above example,three kinds of language each has it's own font to support the display. I mean,these three languages is rendered separately(as to my understanding of the code).

    So, how to make HarfBuzz to select the correct font when many kinds of language are mixed together and render them at once? I mean,without making a font file that supports all languages in the world.

  2. In this example,Chinese script is vertically displayed(which is just as I want),but if I make the Latin script's text_directions to HB_DIRECTION_TTB,which is of course not what I want. I want the whole word 'LATIN' to rotated 90 degree.

So, how can I achieve that? how to make that happen without breaking anything about Chinese layout?

3 .Last but not least,after solving the above problems, I want to make a Text Editor to display and edit many languages at the same time,same place. I don't know if I have to do some work on HarfBuzz or FreeType or implement a text editor that supports this complex text layout? Is there any example that I can refer to ?

Thanks in advance for help.

Was it helpful?

Solution

  1. HarfBuzz is doing shaping just on same script and directionality, you should first split your text, guess or find language and direction of that chunk (using ICU or smt else) then send it to a shaper. Generally on Linux for finding right installed font for a script, you can use fontconfig.

  2. I do not know, I suggest making separate question for that.

  3. Making a text editor starting from shaper is not easy task. You should do bidi, line wrapping and ... that all have their challenges. I suggest use higher level abstraction (pango). For instance browsers doing a lot to support these.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top