A quick lesson in Sanskrit orthography

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2750
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

A quick lesson in Sanskrit orthography

Post by richmond62 » Tue Apr 03, 2018 3:09 pm

Devanagari_Vowels.png
Devanagari (the dominant systems used for writing Sanskrit)
has 2 sets of vowel signs for the same 4 vowels;
see above, left and right of the divider.

Now this, in programming terms is a "pain in the bum"
if one wants to conform to the Unicode standard because
one must EITHER have the forms on the left or those on
the right inwith one's font.

And one, then, "calls" each one in LiveCode like so:

put numToCodePoint(0x0905)

There two ways to offer "punters" a choice between the 2 forms:

1. Position one set of forms in a part of the Personal Private Plain of
the Unicode thing and then call it using different Hex codes.

2. Develop a Multiple Master font with the variant forms on a design axis . . .

However, as far as I am aware there is no way that LiveCode can access
design coordinates in a Multiple Master font.
Screen Shot 2018-04-03 at 5.09.09 pm.png
Full Multiple Master font compliance requires a Multiple Master font.

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 996
Joined: Thu Apr 11, 2013 11:27 am

Re: A quick lesson in Sanskrit orthography

Post by LCMark » Tue Apr 03, 2018 4:15 pm

Unfortunately I think 'multiple master fonts' are a dead-end - e.g. https://forums.adobe.com/thread/395592.

There is a modern variant just starting to appear https://www.commarts.com/columns/variab ... generation.

However, my reading of both multiple master and the new variable fonts is that the purpose is not to allow variation in glyph presentation per-se, but to allow a single font file to contain multiple 'styles' - i.e. bold, condensed, expanded etc.

I *think* what you want is probably better handled by 'variation selectors'. Basically there is a mechanism within Unicode to allow a font to contain multiple glyph forms for the same underling abstract form (e.g. letter, although obviously in this case we aren't dealing with something as 'straight-forward' as roman-like scripts) and it *sounds* like this is a case of that. Here are some resources which might help understand what they are all about:

http://unicode.org/faq/vs.html
http://babelstone.blogspot.co.uk/2007/0 ... ctors.html
https://en.wikipedia.org/wiki/Variant_form_(Unicode)

What isn't clear to me upon scanning those is whether it is possible to define 'private use' type variation selectors - i.e. how much of the decision as to how the selectors work can be encoded in a font without system support...

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2750
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: A quick lesson in Sanskrit orthography

Post by richmond62 » Tue Apr 03, 2018 4:39 pm

Thank you very much LCMark: off to do some reading.

I was wondering whether there was a way to leverage start using font file . . .

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 996
Joined: Thu Apr 11, 2013 11:27 am

Re: A quick lesson in Sanskrit orthography

Post by LCMark » Tue Apr 03, 2018 4:48 pm

@richmond62: 'start using font file' is a better version of 'revFontLoad' - it just allows you to load an truetype/opentype font into the current process so you can use it as 'textFont'.

If you were meaning in terms of multiple master fonts - then they always required a user managed step by using a special (Adobe!) management app to 'generate' the required concrete fonts with the variations on the axes you required (the support was built into Adobe DTP products).

In theory, you could still generate an instance of a multiple-master font if someone has written something which does what that tool used to do - but that would just mean you had two fonts - one for one set of variations and one for the other - which you could do anyway by setting the textFont of the runs you want in one variation or another to different fonts (with the different glyphs).

I'm guessing you want to be able to 'encode' the variations in the strings themselves - so you can choose in one sentence (if that makes sense) mixtures of vowel sign glyphs.

Note: That might still be an option - have two fonts with the different variations and then select them using textFont on the runs. You could 'encode' the selection in your string - but it would need to be processed into 'styled text' to make it appear the way you intended. Variation selectors *might* allow you to do that - without having to do the selection logic yourself - at the expense of having to construct a special font.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2750
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: A quick lesson in Sanskrit orthography

Post by richmond62 » Tue Apr 03, 2018 5:55 pm

Having done some reading on Variation Selectors (mainly over in the Mongolian department:

https://www.unicode.org/charts/PDF/U11660.pdf

and here:

https://www.unicode.org/charts/PDF/UE0100.pdf

I understand how one accesses a variant is by combining a Unicode address with
one of the Variation Selectors, as the dox say:

"182A 180B"

But this:

Code: Select all

on mouseUp
   put numToCodePoint(0x905 0xFE00) into fld "ff"
end mouseUp
throws a bluey
bMeanie.jpg
bMeanie.jpg (9.26 KiB) Viewed 1256 times
as does this:

Code: Select all

on mouseUp
   put numToCodePoint(0x905 FE00) into fld "ff"
end mouseUp
and this:

Code: Select all

on mouseUp
   put numToCodePoint(2309 65024) into fld "ff"
end mouseUp
So there goes my plans to write an app to write home to Mum in Mongolian. 8)
blackMeanie.png
blackMeanie.png (6.33 KiB) Viewed 1254 times
Serious Blech!

https://4eyedgal.wordpress.com/2016/03/ ... el-gerber/

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 996
Joined: Thu Apr 11, 2013 11:27 am

Re: A quick lesson in Sanskrit orthography

Post by LCMark » Tue Apr 03, 2018 6:14 pm

@richmond62: If I understand correctly then variation selectors are no different from any other unicode codepoint - so if you want to encode more than one in a sequence, then you have to do so with separate numToCodepoint's... i.e.

Code: Select all

put numToCodepoint(0x905) & numToCodepoint(0xFE00) into field "ff"

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2750
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: A quick lesson in Sanskrit orthography

Post by richmond62 » Tue Apr 03, 2018 6:20 pm

Code: Select all

put numToCodepoint(0x905) & numToCodepoint(0xFE00) into field "ff"
produced the "blackMeanie" picture. 8)

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 996
Joined: Thu Apr 11, 2013 11:27 am

Re: A quick lesson in Sanskrit orthography

Post by LCMark » Tue Apr 03, 2018 6:27 pm

One thing to consider is that variation selectors are *really* new in Unicode relatively speaking - so you need to be on a recent version of any OS for them to work. I tried you code here (macOS 10.12) and I get just the Mongolian glyph - no VS-1 selector overlaid... Which suggests this version of macOS at least 'knows' about variation selectors.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2750
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: A quick lesson in Sanskrit orthography

Post by richmond62 » Tue Apr 03, 2018 6:30 pm

MTTIW.png
MTTIW.png (13.36 KiB) Viewed 1240 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2750
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: A quick lesson in Sanskrit orthography

Post by richmond62 » Tue Apr 03, 2018 6:34 pm

this version of macOS at least 'knows' about variation selectors.
Totally Groovy 8)

But I am catering to people who have a wide range of machines (and if one wants to talk about "axes" now's the time to do it) from Windows XP, Mac OS 10.7 and Oldish 32-bit Linux distros through to the latest and greatest (which is, after all, a moving target).

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 996
Joined: Thu Apr 11, 2013 11:27 am

Re: A quick lesson in Sanskrit orthography

Post by LCMark » Tue Apr 03, 2018 6:51 pm

Hehe - you do like to make things difficult, don't you @richmond62 ;)

With those constraints, and I'm guessing you aren't wanting to cobble together your own typesetting stack (and integrate it into the engine) - I suggest the two different fonts, and changing the textFont might be the 'best' solution - you can still export a version using variation selectors for those running on systems which support them, but otherwise they'll have to cope with some sort of styled text output (e.g. rtf) which can encode the appropriate font over the appropriate runs.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2750
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: A quick lesson in Sanskrit orthography

Post by richmond62 » Tue Apr 03, 2018 7:08 pm

you do like to make things difficult
Now what, Oh what, could make you think that?

Don't you feel sorry for all the millions of people
who write letters home to Mum in Sanskrit every week? :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2750
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: A quick lesson in Sanskrit orthography

Post by richmond62 » Wed Apr 04, 2018 8:20 am

changing the textFont might be the 'best' solution
Yes, you are certainly right IFF one is exporting one's end-product to PDF
or an image format.

It might however, play "merry hell" if exporting to RTF or HTML as it
presupposes the end-user has ALL one's family of variant fonts on their system.
Last edited by richmond62 on Fri Aug 31, 2018 11:47 am, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2750
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: A quick lesson in Sanskrit orthography

Post by richmond62 » Fri Aug 31, 2018 11:46 am

Well, at long last I have circumvented the variation selector problem by working out
how to allow my Devawriter Pro to use 2 fonts (ones that are "the same, but different", with the varaints)
at the same time.

What is now "rubbing me up the wrong way" is the way that LiveCode seems to rely on certain aspects of
the underlying OS to decide whether it can display a Unicode glyph or not . . .

Certain glyphs that display perfectly correctly in LC on Linux just come out as "orrible squares" on MacOS.

I wonder if there is a way to circumvent this?

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”