copy ligature's unicode

Hi everybody,
please, is that possible to make an OT feature that behaves like standard ligature feature, but when the ligature is shown it can be copied? When 'fl' is turned into ligature, the letters 'f' and 'l' are copied, in my case I need to copy the ligature itself. So in this 'fl' example I would be pasting 'fl' (U+FB02) after copying the ligature and not 'fl' (U+0066 U+006C) as it is normally. Thanks for any ideas for workarounds as I guess it won't go purely OT.
Tagged:

Comments

  • Kent Lew
    Kent Lew Posts: 930
    Copy-and-paste of the underlying text codepoints is a function of the application and system environment, not of the font.
  • jansindl3r
    jansindl3r Posts: 17
    @Kent Lew
    yes I thought so, but there must be a work-around for this, no?
  • OpenType features don't have any effect on the underlying representation of the text, only on the actual glyphs which are displayed. So no, there won’t be any workaround for this. If the underlying text is 0x0066 0x006C (fl), then that is what will be copied.

    Why do you need them copied as 0xFB02, btw?
  • jansindl3r
    jansindl3r Posts: 17
    @André G. Isaak ok thanks.. this is just an example to simplify my problem, in reality it's an idea to use syntax to call hardly accessible glyphs
  • Kent Lew
    Kent Lew Posts: 930
    Assuming I understand your goal, you might be better off building a specialty keyboard to input the desired end codepoints and distributing it with the fonts.
  • Thomas Phinney
    Thomas Phinney Posts: 2,859
    edited July 2019
    You could always provide two copies of the ligature glyph in the font: one that is accessed via the ligature feature and unencoded, and another that is not connected to the feature, and encoded. But it would be up to the user to access the encoded glyph instead of using the feature. Some extra-clever apps might still foil this scheme, but in most cases that would allow you to copy and paste the U+FB02 codepoint; the problem would be getting it into the document in the first place. Kent’s suggestion of a custom keyboard driver would work for that, although all told, all this would be a lot of work!
  • Khaled Hosny
    Khaled Hosny Posts: 289
    I think @Thomas Phinney's suggestion is for copying from PDF, copying from other kinds of documents that has access to the text not only the output glyphs wouldn't be affected.
  • Thomas Phinney
    Thomas Phinney Posts: 2,859
    @Khaled Hosny:
    My suggestion involved changing the text input as well. It should affect everything... unless the app/OS is so clever as to map from U+FB02 back to the component characters, without the help of the initial text stream or the font in doing so.

    Entirely possible, but not typical, in my experience.
  • Such an operation needs access to individual glyph indexes, and usually your PDF tool doesn't allow that – if only because without the actual font, the glyph index is worthless.

    Also, not all ligatures have a Unicode value. Actually it's quite the opposite: your example "fl" is one of the very few (and a decision oft regretted ever since). The OT feature you describe is exactly the reason why ligatures don't require unique Unicode codepoints. It also means they are absolutely font-dependent.
  • Thomas Phinney
    Thomas Phinney Posts: 2,859
    Neither I nor the original poster mentioned PDF. Not sure why people keep assuming it is the default use case?

    The original poster’s description assumes and requires that the ligature be encoded. But it is a good point that only a few have a “real” Unicode (five common Latin ligatures, plus some for other writing systems). We do not know if the font has more than those, or not. That would be an important clarification.
  • Khaled Hosny
    Khaled Hosny Posts: 289
    IIUC, @jansindl3r, wants to use ligatures to workaround inputting characters not readily available in common keyboard layouts, so he wants the glyphs to change the underlying text which is nothing that can usually happen unless one is “regenerating” text from the output glyphs as it is often the case with PDF
  • jansindl3r
    jansindl3r Posts: 17
    @Khaled Hosny thanks! As said, I would like to have a smileface for example that can be accessed with special syntax. I think that leaving the syntax under the accessed glyphs is kind of risky. I tried many different things like hiding the syntax into zero width glyph, hoping that apps will ignore it. Even if that work, it doesn't have to work everywhere and always. I assume that best solution would be a script that 'bakes' the ligature into the ligature glyph with unicode. Thanks for all the ideas!