Is it possible to type in Furigana (and Ruby characters) using Unicode?
Asked Answered
R

1

8

I am currently making a Corona app where I would like to include Japanese text. For those of you who do not know, it appears that Japanese has multiple languages to write in text (Kanji, Hiragana, etc.). Furigana is a way to have Kanji characters with Hiragana in what looks to be subtext (or Ruby characters). See the Ruby slide on this page for an example.

I am looking for a way to use Furigana in my app. I was hoping there was a way to do it using Unicode. Well, I stumbled upon the Interlinear Annotation characters and tested them out (using unicodeToUtf8 and the LastResort font) in Corona as follows: :

    local iaAnchor = unicodeToUtf8(0xfff9)
    local iaSep = unicodeToUtf8(0xfffa)
    local iaTerm = unicodeToUtf8(0xfffb)
    local options = {
        parent = localGroup,
        text = iaAnchor .. "漢" .. iaSep .. "かん" .. iaTerm .. iaAnchor .."字" .. iaSep .. "じ" .. iaTerm,
        x = 285,
        y = 195,
        font = "LastResort",
        fontSize = 24,
    }
    local testText = display.newText(options)

Unfortunately, I had no success and ended up getting something like this:

Bad Furigana Results

So, my question is, is it possible to get Furigana (and Ruby characters) to work using Unicode? Or is this not an actual usable feature in Unicode? I just want to make sure that I am not wasting my time trying to get this stuff to work.

I checked out the Interlinear Annotation Characters section in this Unicode report, but the jargon is a bit too thick for me to understand what they're trying to say. Are they implying at all that such characters should not be used in regular practice? If so, then the previous resources on Unicode Ruby Characters is a bit misleading.

Rugose answered 23/6, 2015 at 17:46 Comment(0)
T
5

Interlinear Annotation Characters are a generic tool for annotating text (like Furigana, Bopomofo, or other phonetic guides), but the Unicode Standard doesn't specify how they should be interpreted or rendered. That is, you will probably have to implement rendering support for them yourself because most libraries do not know what to do with them.

It might be easier to use a higher-level protocol that already supports rendering Ruby text. For example, if you have access to an API that can render HTML, you can use the <ruby>/<rt> tags—which have well-defined rendering semantics.

Trimly answered 23/6, 2015 at 18:43 Comment(2)
> the Unicode Standard doesn't specify how they should be interpreted or rendered Do you have any references for why Unicode didn't attempt to specify a way of rendering Interlinear Annotation Characters? I'm interested in finding discussions of this topic in order to understand the historical context and design decisions.Kaka
@Kaka Unicode, in general, is designed to facilitate interchange and not layout. There are many design choices when laying out text like this, which are beyond the scope for a character encoding. You can find this attitude in documents like the original proposal and technical reports.Jessicajessie

© 2022 - 2024 — McMap. All rights reserved.