3

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.

gone
  • 823
  • 8
  • 21
  • I'm confused by the "which is of course not what I want" comment - in Japanese or Chinese, this is exactly what you'd want: you don't want the word written normally but rotated 90 degrees. Proper behaviour lines the letters up underneath each other, what you want is something that overrides the font's layout instructions. – Mike 'Pomax' Kamermans May 08 '14 at 01:36
  • yes,to your comment,in Japanese or Chinese,this is exactly what I want,but if I want to display English or other Latin language,the line is vertical while letters remain upright- THIS what I don't want.I may not have described the issue clearly,because of my poor English,sorry for that.What I'm trying to achieve is that layout all text in vertical direction,Chinese or Japanese words remain upright,Latin Letters rotated 90 degrees. – gone May 10 '14 at 06:19
  • a picture is worth a thousand words. Can you add an image or link to an image that shows what that looks like? (because on multiple lines of text, if you mean what I think you mean, that's going to do horrible things) – Mike 'Pomax' Kamermans May 10 '14 at 22:01
  • I didn't have enough reputation to add pics in my post at that time. Now I've already added a screenshot of that example. The text at the top is traditional Mongolian text ,which should be in vertical direction , but due to the problem of the vertical display(and I don't know how to fix that),it will not be displayed properly. Below is Latin in vertical direction. – gone May 12 '14 at 06:55
  • I meant can you post a picture of what you *want* it to look like? – Mike 'Pomax' Kamermans May 12 '14 at 15:39
  • you'd need to find a font with a `vrt2` table that has the glyphs and vmetrics to achieve this. you probably don't want to rely on the shaping engine to pull this trick off, but just make sure the font has the correct vertical data – Mike 'Pomax' Kamermans May 13 '14 at 05:16
  • Thanks for your advice,but I don't really want to be constrained by the font files,and even if I found those fonts with vertical data,I'll still have to do some work on those libraries like harfbuzz and freetype I guess. I tried [indic-text-renderer](https://code.google.com/p/indic-text-renderer/) and sadly ,no success.However, it gives me some hope.Now I'm trying to cross compile those libs and put it into the project and see what will happen,and this is the only way to make the final decision on whether I have to stuck on these things or not. – gone May 13 '14 at 07:40
  • no: the font tells the engine what to shape the text as, so if it comes with vrt2 and vmetric data that makes latin text render the way you show, then harfbuzz etc. will do that. The font contains all the shaping instructions, and the shaping engine simply follows those instructions. So, the trick is then to make sure your application simply uses the right fallback font for latin. – Mike 'Pomax' Kamermans May 13 '14 at 14:53
  • After having struggled for almost 2 weeks, I finally get my job done last night. However, further development is needed.But I'm so excited.Your advice on using vrt2 and vmetric will be considered,thank you so much ! – gone May 14 '14 at 01:59

1 Answers1

4
  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.

Ebrahim Byagowi
  • 10,338
  • 4
  • 70
  • 81
  • Ha,thanks so much for answering, I guess I have to get back to pango and leave harfbuzz stuff as it is.Can't afford my time on re-inventing wheel. – gone May 07 '14 at 08:05