googlefonts / fontra

A browser-based font editor
https://fontra.xyz
GNU General Public License v3.0
514 stars 21 forks source link

Edit text string directly in the central editing area #566

Open mrk-z opened 1 year ago

mrk-z commented 1 year ago

Is it possible to have the functions to edit the text string, for example add/delete/copy glyphs, directly in the central editing area, without needing to switch to the text tab in the left panel ?

Sometimes we want to do something to the current glyph, and "switch tab -> locate the current glyph in the text string -> edit the text string" are just a lot of extra steps, especially when there is a long text string, or many similar/unfamiliar characters, or a lot of unicode involved.

Maybe some commands in the context menu (search and add a glyph to the right/delete the current glyph/copy the current glyph)? or something like Glyphs' interface, where you can edit text strings like a text editor directly in the central area when it's in text mode?

mrk-z commented 1 year ago

Some situations I've run into:

  1. I was editing a glyph and wanted to copy it to InDesign to check this glyph in other fonts, but in order to copy it I had to switch tab and locate it in the text string.

  2. I accidentally opened a component by double-clicking, and to delete it I needed to switch tab and find it in the text string. Since components are in unicode, I'd also needed to check the unicode, and made sure to select the right section of the text string to delete.

  3. I wanted to search for a glyph to put it on the right side of the glyph I'm currently editing, in order to copy a component from it. A few things made this operation a little tricky:

    • First of all, if I stay in editing mode, and searched for a glyph in the Search tab and click on it, it would just replace the current glyph, so I lose the glyph I was editing. In order to get it back I need to switch tab and type it again in the text string box or copy it from somewhere else.
    • if I exit editing mode, search a glyph and clicked on it, it would just add it to the end of the string, so I need to go to the text string box to copy/paste it to where I want
    • For localizations, since the text string currently doesn't support "character+suffix", I'd need to find the unicode and type it in the right format.
justvanrossum commented 1 year ago

FWIW, I implemented this last week: https://github.com/googlefonts/fontra/pull/559 which adds the current character as a copyable character to the U+XXXX string in the info panel. This has not yet been deplyed, though.

justvanrossum commented 1 year ago

While I would love to add full text editing capabilities to the main canvas eventually, this is a huge project, and we'll have to see how/when to prioritie it.

justvanrossum commented 10 months ago

Some notes after researching:

My current conclusion is that we'll need some hacks to make this work properly, such as having an invisible text input to capture the events, possible making it visible once compositionstart fires.