Personally I would avoid the underscore, because I like to reserve it for ligatures (and thus avoid triggering an auto-generated feature). So, I’d go with something like .circleOpenInit, but in this case, I suppose it will not be a problem, unless you have a glyph called medi or init.
In this case, there is no way Glyphs can guess what you want. So you will have to add the feature code manually, I am afraid. Raise your hand if you need help.
Assuming OT class @num contains your figures zero through nine, and @numCircleXXXX contains zero.xxx through nine.xxx, in its different forms, put this in your dlig:
sub parenleft @num parenright by @numCircleIsol; # (1)
sub parenleft' @num' @num by @numCircleInit; # (1…
sub [@numCircleInit @numCircleMedi] @num' by @numCircleMedi; #…1…
sub @numCircleMedi parenright by @numCircleFina; # …1)
Edit: The code is wrong. see below for explanation.
I didn’t test it now, but it should work without putting it in different lookups, but perhaps the last line still needs to go between something like this: lookup CIRCLEFINA { … } CIRCLEFINA;
Do the same for bracketleft and bracketright, this time with the other numerals.
Hello,
I found this thread very useful as I am attempting something similar.
I want to create a feature with numerals inside a circle, 0—99 only.
Since I only need two digits, should I still be using the Init, Medi, Fina logic?
Any help is appreciated!
I’ve already got my classes set up as follows:
num (numerals, zero to nine)
numCircleIsol (zero.isol, ecc.)
numCircleInit (zero.circle, ecc.)
numCircleMedi (zero.medi, ecc.)
numCircleFina (zero.fina, ecc.)
Hi,
I tried this feature but it doesn’t work, I have an MakeOTF error saying “invalid ligature” on each line.
I attached a screenshot: I have 5 classes ( @num, @OpenCircleIsol , @OpenCircleInit, @OpenCircleMedi and @OpenCircleFina) of 10 digits each.
Did I missed something somewhere?
Cheers,
T
You cannot ligate a group with something else to another group. My code above was wrong. You will have to split up the group ligatures to lines for individual glyphs, or use contextual one-to-one subs for groups.
Watch our for the contextual tick mark, should be ' and not the smart quote ’
Ok, now it works with a lookup.
I prefered to keep the parenleft and parenright to activate the circled numerals, then replace it with zeroWidthNoBreakSpace.
sub parenleft @num' parenright by @Isolated;
sub parenleft @num' by @Initial;
lookup MEDIAL {
sub @num by @Medial;
} MEDIAL;
sub @Medial' parenright by @Final;
sub parenleft by zeroWidthNoBreakSpace;
sub parenright by zeroWidthNoBreakSpace;
@figures = [one two three four five six seven eight nine zero]
@figuresINIT = [one.circled.init two.circled.init three.circled.init four.circled.init five.circled.init six.circled.init seven.circled.init eight.circled.init nine.circled.init zero.circled.init];
@figuresMEDI = [one.circled.medi two.circled.medi three.circled.medi four.circled.medi five.circled.medi six.circled.medi seven.circled.medi eight.circled.medi nine.circled.medi zero.circled.medi];
lookup init {
sub parenleft' one' @figures by one.circled.init;
sub parenleft' two' @figures by two.circled.init;
sub parenleft' three' @figures by three.circled.init;
sub parenleft' four' @figures by four.circled.init;
sub parenleft' five' @figures by five.circled.init;
sub parenleft' six' @figures by six.circled.init;
sub parenleft' seven' @figures by seven.circled.init;
sub parenleft' eight' @figures by eight.circled.init;
sub parenleft' nine' @figures by nine.circled.init;
sub parenleft' zero' @figures by zero.circled.init;
} init;
lookup medi1 {
sub @figuresINIT @figures' by @figuresMEDI;
} medi1;
lookup medi2 {
sub @figuresMEDI @figures' by @figuresMEDI;
} medi2;
lookup fina {
sub one.circled.medi parenright by one.circled.fina;
sub two.circled.medi parenright by two.circled.fina;
sub three.circled.medi parenright by three.circled.fina;
sub four.circled.medi parenright by four.circled.fina;
sub five.circled.medi parenright by five.circled.fina;
sub six.circled.medi parenright by six.circled.fina;
sub seven.circled.medi parenright by seven.circled.fina;
sub eight.circled.medi parenright by eight.circled.fina;
sub nine.circled.medi parenright by nine.circled.fina;
sub zero.circled.medi parenright by zero.circled.fina;
} fina;
You probably do not need to differentiate between medi1 and medi2, and can probably merge them into a single lookup.
Everything is working perfectly with the .left and .right things, but there comes a thing that I cannot resolve: how to make the three digit circled numbers?
This is the code that I try to apply but it doesn’t work.