Chaining substitution (?)

mauro sacchettomauro sacchetto Posts: 194
edited September 4 in Font Technology
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 <> 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 [\ ] [\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;


lookup SingleSubstitutionlookup34 {

  lookupflag 0;

    sub \ by \ ;

} 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...


  • André G. IsaakAndré G. Isaak Posts: 425
    edited September 4
    Is your quoteright-> 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.
  • I deleted quoteright -> 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 should remain
  • André G. IsaakAndré G. Isaak 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?
  • Not being either a LaTeX or open office user, how exactly do you activate small caps vs all small caps in these programs?
  • 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.
  • mauro sacchettomauro sacchetto 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 --> 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

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

  • John HudsonJohn Hudson 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.
  • mauro sacchettomauro sacchetto 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?
  • 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?
  • Is your smcp code only a basic line "sub @lower by"?

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

        sub \quoteright' by \ ;

    so it gets executed after the to-small caps code. I think that ought to work.
  • 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.
  • languagesystem statements belong at the very beginning of your feature file.
  • mauro sacchettomauro sacchetto 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 
    - all capital letters
    - a substitution rule according to which becomes quoteright if precedes a capital letters?
    For my aim is to keep D and O uppercase in any case
  • John HudsonJohn Hudson 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.
  • André G. IsaakAndré G. Isaak 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 and 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->

    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.
  • 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.
Sign In or Register to comment.