ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
8.67k stars 2.24k forks source link

Fix Tibetan letter stacking #1658

Closed hssm closed 8 years ago

hssm commented 9 years ago

Originally reported on Google Code with ID 755

What steps will reproduce the problem?
1.  Create  deck with Tibetan Text in Anki on a PC/Mac
2. Sync with your account 
3. Open the cards on Android

What is the expected output? What do you see instead?
The expected output is to see Tibetan CHaracters, currently seeing boxes

What version of AnkiDroid are you using? On what version of Android?
Latest version...

Please provide any additional information below.
The tibetan characters are Unicode, not a specific font, as far as i know android does
not support tibetan unicode directly, i have a work around, but it requires embedding
the font in the application, i am wondering if this is a problem with any other languages?

Reported by oqrbrian on 2011-08-27 14:53:27

hssm commented 9 years ago
Issue 742 and Issue 763 mention problems with Koine Greek despite the presence of appropriate
fonts. Perhaps they are related to this issue.

Reported by mikemorr.com on 2011-09-04 00:00:37

hssm commented 9 years ago
It looks like characters don't automatically fall back (see Issue 779), and setting
the "Default font" preference doesn't necessarily work either (see Issue 778). So I
think the font has to be specified in the card layout. For example, I downloaded the
shared deck "Tibetan Alphabet". That deck specifies "font-family: Arial". So I downloaded
a free Tibetan font, put it in my AnkiDroid/fonts folder, and renamed it to "Arial.ttf",
and that made the Tibetan characters appear on the cards.

Reported by mikemorr.com on 2011-09-06 01:13:47

hssm commented 9 years ago
Interesting , how do you know what font the deck is using? IE how do you know it was
arial?

Reported by oqrbrian on 2011-09-06 08:09:38

hssm commented 9 years ago
Here's how I find out what font the deck is specifying:
Open the deck on Anki on a desktop machine
Settings > Deck Properties...
Select a model and click "Edit"
Click "Card Layout"
If it says "font-family: Arial" or whatever in the Card Templates tab, that's it; otherwise
click the Fields tab and look for the font name there.

Reported by mikemorr.com on 2011-09-06 11:05:41

hssm commented 9 years ago
Yes, this works, sort of, however the letter stacking is not rendered properly, i may
try a few different fonts. I have read previously that letter stacking was a problem:
http://tom.to/blog/archives/76  , i have used his solutions for other apps and it works.
Renaming my tibetan font to arial.tff works for me.  I hope that google will fix the
stacking problem, other wise i would have to add tom.to's hack to your program and
convert the unicode to the precomposed font... thanks for thinking with.

Funny i see you have a umich email address, i was born in michigan! haha, i am very
thankful for this program. i have been using other programs and flash cards but they
did not have the sync function to use across different computers, it is great!

Thanks! 

Reported by oqrbrian on 2011-09-06 11:21:53

hssm commented 9 years ago
oqrbrian, thanks for the link!
Would you (or any volunteer) be able to integrate Tom Meyer's code into AnkiDroid?
You could take example on the code for Arabic, which was a rather similar issue I think.
We are ready to help if you have any question :-)

Reported by nicolas.raoul on 2011-10-07 06:51:16

hssm commented 9 years ago
Yeah, i have downloaded the source and have started playing with it, since not many
people are probably using Anki for Tibetan i would find it strange to integrate a hack
for one language into the main branch. It is an issue in android which i hope they
fix as soon as possible, because you can not even view website in Tibetan standard
on Android. However perhaps we could make a Tibetan branch of Anki for those that use
it for studying Tibetan.  

I would really love to do the work but i am not sure when i can complete it, perhaps
in early november i could do something completed (major project running now). However
if someone else has time and interest they should go for it;)

I will post back here when i have something working and if no one else has solved it.
Then we can see what todo about integration etc..

Reported by oqrbrian on 2011-10-07 07:51:56

hssm commented 9 years ago
> "since not many people are probably using Anki for Tibetan"
Don't worry about that!
Just make it an opt-in setting in preferences, like is done for Arabic :-)
Good luck with your current major project!

A great place to get started with AnkiDroid development is here:
https://code.google.com/p/ankidroid/wiki/Contribution

Reported by nicolas.raoul on 2011-10-07 07:56:49

hssm commented 9 years ago
Well, OGRBR is not the only person using Anki for tibetan :)
one possible workaround for stacking is using the Jomolhari font, for tibetan. it hasn't
been here mentioned yet. this font contains all possible combinations for tibetan and
I think also most of sanskrit stacks, you can find in classical tibetan.

Other option / proposal would be to be able to render tibetan from specific field,
or maybe some formatting stuff similar to ruby annotation support? this would enable
to enter tibetan wylie in let's say {} and Anki would send this to renderer, rather
than output directly.

Thank you, Marek

Reported by jasovsky.marek on 2012-03-19 05:17:09

hssm commented 9 years ago
Fixed letter stacking for Tibetan. Tibetan keyboard needed, which produces precomposed
characters. (APK can be found in https://github.com/marek-jasovsky/TibKeyboard/blob/master/BhoBoard/bin/BhoBoard.apk
)

Currently, when Tibetan is enabled in Settings, CardBrowser and CardEditor (without
search field) are displaying Tibetan properly)

Further fixes will follow.

Reported by jasovsky.marek on 2012-03-28 10:07:35

hssm commented 9 years ago
Tibetan font not seen properly in the cards as displayed for learning.
Tibetan font seen only when pressing "modify card".
How can we fix this ?

Reported by nayeli.anguerin on 2013-02-06 17:34:15

hssm commented 9 years ago
Seen like this in flashcards.
I would gratefully appreciate your help :)

Reported by nayeli.anguerin on 2013-02-06 17:38:32


hssm commented 9 years ago
Seen like this in flashcards.
I would gratefully appreciate your help :)

Reported by nayeli.anguerin on 2013-02-06 17:38:59


hssm commented 9 years ago
Hi nayeli.a...@gmail.com,   this issue is not  easy because there are so many ways to
write tibetan and the UTF standard is not always 100% standard.  Anyways i hope someday
to help and make a complete fix for this but i am actually hoping that Google will
get its act together and fix this.. as it is mostly a problem with google. 

firstly it is important that you cards are made with unicode tibetan instead of "tibetan
font"  for my work around to work. However if you are using another tibetan font then
it is just a matter of renaming your font to Arial i believe and it will work. 

So the way i solved it was to put the Tibetan Machine Unicode font in my fonts directoy
inthe AnkiDroid directory on the android device. However i renamed the ttf file to
Arial.ttf. and that works! I am not sure why this is supposedly you can have different
fonts per deck and add the font files in the AnkiDroid directory but i could not get
this to work, naming a unicode font arial was the only thing that worked for me. 

I attached the font file that i use, remember this is NOT Arial it is a Tibetan Unicode
Font, so create a folder on your android device

If you install this font and then download the word list: https://ankiweb.net/shared/info/1295548096
and see if the letter stacking is correct..  I tested this on HTC Desire, Samsung SIII
and the Nexus tablet and it worked everywhere...   If you are using a different font
then just name it arial.ttf and put it the fonts directory it might work.

I am not sure really why this works because i also have cards that are in devanagari
script and there is no conflict with the font... so apparently the android renders
that natively.  Anyways you can give this a try until a real fix is made. Let me know
if it works for you too.

Reported by oqrbrian on 2013-02-06 18:45:37


hssm commented 8 years ago

It sounds like this issue can be resolved (mostly?) by using a custom font. Ultimately it's an Android problem which seems to have been resolved in Android 4.2.