#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Chaining substitution (?)

Posts: 194
edited September 4
Plz, consider the image:

And here is the problem: where I have a text in small caps, but with capital letters (second line of the image; in LaTeX, for example, <\textsc{D'Onofrio}>, but the same thing happens with the option <:smcp> in OpenOffice) , the <quoteright.sc> is also used between capital letters, while in this specific case I would like it to be "normal" or "capital" (as in the third line of the image).
I thought about creating this code:

``````lookup caltContextualAlternateslookup31 {

lookupflag 0;
sub [\quoteright.sc ] [\A \B \C \D \E \F \G \H \I \J \K \L \M \N \O \P \Q \R \S \T \U \V \W \X \Y \Z ]'lookup SingleSubstitutionlookup34  ;
} caltContextualAlternateslookup31;feature calt {

script latn;

language AZE  exclude_dflt;

lookup caltContextualAlternateslookup31;

language CRT  exclude_dflt;

lookup caltContextualAlternateslookup31;

language DEU  exclude_dflt;

lookup caltContextualAlternateslookup31;

language FRA  exclude_dflt;

lookup caltContextualAlternateslookup31;

language ITA  exclude_dflt;

lookup caltContextualAlternateslookup31;

language MOL  exclude_dflt;

lookup caltContextualAlternateslookup31;

language ROM  exclude_dflt;

lookup caltContextualAlternateslookup31;

language TRK  exclude_dflt;

lookup caltContextualAlternateslookup31;

language dflt ;

lookup caltContextualAlternateslookup31;} calt;``````

and

``````lookup SingleSubstitutionlookup34 {

lookupflag 0;

sub \quoteright.sc by \quoteright.fr ;

} SingleSubstitutionlookup31;``````

The trouble is that it doesn't work I don't know if it depends on the fact that the system also means capital letters as small caps and therefore does not apply the rule, or if my approach is completely wrong...

• Posts: 425
edited September 4
Is your quoteright->quoteright.sc substitution included in your 'smcp' feature code or only in your 'c2sc' code? It should be in the latter but not the former. Then you shouldn't need any sort of contextual clean-up code at all.
• Posts: 194
I deleted quoteright -> quoteright.sc substitution in 'smcp' feature and put it into 'c2sc' code.
But now the uppercase quoteright is always used even when the text is all and only in small caps
and therefore no substitute should be made and the quoteright.sc should remain
• Posts: 425
edited September 4
Did you get rid of your calt lookup? When you say 'all and only in small caps' do you mean when the 'c2sc' is selected or do you mean when the text is set in all lower case?
• Posts: 425
Not being either a LaTeX or open office user, how exactly do you activate small caps vs all small caps in these programs?
• Posts: 425
Also, on an unrelated note, why do you have a lengthy series of lines like the following?
``````language TRK  exclude_dflt;
lookup caltContextualAlternateslookup31;``````
since caltContextualAlternateslookup31 is part of the default, all of these can simply be left out. If you have registered these languages as part of your languagesystem statements, all of these will automatically be included as "language TRK  include_dflt;" which would save you a lot of typing.
• Posts: 194
edited September 4
In LaTeX
\textsc{small caps text}.
With LibreOffice I select the font in the font windows and add at end the string <:smcp>; then, I come back to the text window and write.
I cancelled the 'calt' lookup, cancelled the quoteright --> quoteright.sc substitution in 'smcp' and put it into 'c2sc'.
Now, if I write <D'Onofrio> in small caps but with uppercase initial \textsc{D'Onofrio}, all seems to work fine.
On the contrary, if I write all in small caps \textsc{d'onofrio},  I've still the quoteright, and not quoteright.sc:

Compare it with the first line of the image of my first post

• Posts: 1,657
That's how it's normally supposed to work: smcp is used for characters that should change when lowercase is converted to smallcaps, and c2sc is used for characters that should change when uppercase is converted to smallcaps. Typically, punctuation is only changed when uppercase is converted to smallcaps.

If you change the text encoding to all lowercase — d'onofrio —, then what you are displaying is exactly what I would expect.
• Posts: 194
edited September 4
Yes, I see. But then how can I modify the apostrophe according to the above needs?
A chainig substitution (a right one, not wrong as mine) is not the solution?
• Posts: 194
PS
If you have registered these languages as part of your languagesystem statements, all of these will automatically be included as "language TRK  include_dflt;" which would save you a lot of typing.
Useful remark. But where languagesystem statements are registered? Is it enought in the first lookup?
• Posts: 97
Is your smcp code only a basic line "sub @lower by @lower.sc"?

Then you might try to add a new subtable after it:

``````    sub @lower.sc \quoteright' @lower.sc by \quoteright.sc ;
``````

so it gets executed after the to-small caps code. I think that ought to work.
• Posts: 425
I think the problem is with how you're creating small caps in LaTeX and open Office. Applications should have a way of creating small caps, which only calls smcp and only affects lowercase letters, and a second way of creating all small caps, which calls both smcp and c2sc and thus affects both lower- and upper case letters. It sounds like to get your first line (all small caps) you're entering d’onofrio rather than D’Onofrio as the underlying text and then only calling 'smcp' feature.
• Posts: 425
languagesystem statements belong at the very beginning of your feature file.
• Posts: 194
edited September 4
@Theunis de Jong
Do you mean a subtable of 'smpc' for simple substitution? With 2 glyphs inside? Is it possible??

@André G. Isaak
I create small caps only from lowercase letters. I think it's normal practice. In fact I write <\textsc{d'onofrio}> to have all (letters and apostrophe) as .sc.
I can create a LaTeX command to have all upper- and lowercase in small caps
but this way even D and O of D'Onofrio becomel cap.

Now I'm pretty confused
But is it incorrect the idea of ​​creating a chaining substitution according to which I have
- quoteright.sc
- all capital letters
- a substitution rule according to which quoteright.sc becomes quoteright if precedes a capital letters?
For my aim is to keep D and O uppercase in any case
• Posts: 1,657
I create small caps only from lowercase letters. I think it's normal practice.
It was the normal practice in old Type 1 smallcap fonts, because these usually only had smallcaps in the lowercase character slots. This meant that if one wanted smallcaps to represent uppercase letters, one had to edit the text itself and convert uppercase characters to lowercase.

Smallcaps are typographic variants that may represent either upper- or lowercase characters depending on their typographic role. So the two OpenType Layout features <c2sc> and <smcp> are intended to provide for substitutions of, respectively, uppercase and lowercase to smallcaps. This means that one doesn't need to edit and change the encoding of the text in order to display it in smallcaps. One shouldn't need to change NASA to nasa just to get it to appear as smallcaps.

When smallcaps do represent only lowercase letters, the norm is for punctuation to remain in default style like the caps.
• Posts: 425
edited September 4
It sounds like OpenOffice has a terrible interface for OpenType. If you want D’Onofrio in all small caps, you should enter it as 'D’Onofrio’ and then enter <:smcp+c2sc> (or whetever the correct syntax is) rather than entering 'd’onofrio' and then applying only smcp.

The way I normally implement small caps, which I think is rather standard except that I don't bother with having separate a.sc and A.sc characters, is as follows: I create three classes, SmallCaps, LCToSmallCaps and UCToSmallCaps.

The smcp feature includes

sub @LCToSmallCaps by @SmallCaps;

along with a few oddballs with no uppercase equivalents such as dotlessi->dotlessi.sc.

The c2sc feature includes

sub @UCToSmallCaps by @SmallCaps;

followed by substitutions which convert numerals to small figures and which replace punctuations, brackets, ampersands etc. with small cap forms where appropriate.

This approach, however, only works if the user is entering text in its normal upper- and lower-case form and then selecting 'smcp' when they want mixed uppercase/small caps or selecting 'all small caps' (which calls both 'smcp' and 'c2sc') when they want all small caps.

You should make use of the LaTeX command you mention to get small caps from both upper and lowercase letters rather than entering everything in lowercase; For OpenOffice I think you're stuck having to enter both features manually.

Basically, the problem seems to be an application interface problem rather than a font problem.
• Posts: 194
Yes,, Open/LibreOffice handle small caps very badly. In reality they produce fake small caps by reducing capital letters by about a third. If you want to use authentic small caps (if the font has them), you need to intervene manually with a not complex but certainly annoying process.
With LaTeX, much more versatile in the management of the characteristics of the .otf fonts, it is possible to transform both the lowercase and the uppercase, as well as text composed of lower- and uppercase directly into small caps.
As far as my problem is concerned, now I'll do more test with font and at the same time I'll see if instead there is a solution through LaTeX.