Bug Hunting Session
Bug 94957 - add unicode conversion shortcut (alt+x) to Math
Summary: add unicode conversion shortcut (alt+x) to Math
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
5.1.0.0.alpha0+ Master
Hardware: Other All
: medium enhancement
Assignee: Justin L
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-11 14:30 UTC by Laurent BP
Modified: 2015-10-17 20:07 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Example of Greek letters in Math (13.69 KB, application/vnd.oasis.opendocument.text)
2015-10-11 20:09 UTC, Laurent BP
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent BP 2015-10-11 14:30:28 UTC
Description: I read resolution of bug 73691 which eases entering unicode character by typing its code, then Alt+X (or other short cut depending on OS). It is not (yet) available for Math. It could be added?

Steps to reproduce:
1. Create a new document Writer, Calc, Impress or Draw
2. Enter a unicode, such as "2026" than Alt+X
=> unicode is replaced by character "…"
3. Create a new Math document
4. Enter a unicode, such as "2026" than Alt+X

Expected behavior:
=> unicode is replaced by character "…"

Actual behavior:
Nothing is changed and code 2026 remains

Math is coding special characters (Greek letters or mathematical symbols) with a language specific code (%omega in English, %oméga in French) which may destroy Math formula when changing UI language. Using unicode would be a good solution.

Version: 5.1.0.0.alpha1+
Build ID: 143fb0a4b5d4ab69d4928299d8112ab95d99870a
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2015-10-11_00:06:41
Locale: fr-FR (fr_FR.UTF-8)
Comment 1 V Stuart Foote 2015-10-11 16:53:53 UTC
Well, sure, it is reasonable to check on adding CLI Unicode support to the Math - formula editor, and its "experimental" visual mode--so a new enhancement.

But as its GUI font support is already quite far removed from the other modules, it is unlikely to be achieved in the Math formula editor as was just done elsewhere.

Presently, using the "Fonts" dialog (Format -> Fonts)--Font families are explicitly defined for use in Formulas as variables/functions/numbers/text, and as a list of alternative fonts in the Custom stanzas for use with embedded FONT switches in the Math Commands window.

Glyphs from any font family can be inserted into any location in the command windows or in the visual editor by GUI using the "Symbols" dialog (Tools -> Catalog) and selecting by GUI from the defined symbol sets. Beyond default greek/igree/special symbol sets, one can define their own. Or any existing assignment can be changed.

New "additions" to support undefined MathML 2.0 elements can be made in the same GUI dialog.  Point is, IIUC a CLI insertion for a Math Formula must provide additional structure about the glyph beyond what was just implemented to be of use here. In a sense doing it duplicates much of the work that bug 32418 would require.

@Frédéric, JBF, Regina... any thoughts on utility and a priority of pursuing either?
Comment 2 Jean-Baptiste Faure 2015-10-11 17:10:56 UTC
(In reply to Laurent BP from comment #0)
> [...]
> Math is coding special characters (Greek letters or mathematical symbols)
> with a language specific code (%omega in English, %oméga in French) which
> may destroy Math formula when changing UI language. 

Sorry Laurent, but you are wrong here, Greek letters are always saved in English coding in ODF files, whatever the UI language is.

Best regards. JBF
Comment 3 Laurent BP 2015-10-11 20:09:42 UTC
Created attachment 119522 [details]
Example of Greek letters in Math

(In reply to V Stuart Foote from comment #1)
> Well, sure, it is reasonable to check on adding CLI Unicode support to the
> Math - formula editor, and its "experimental" visual mode--so a new
> enhancement.
I do not know what is exactly "CLI Unicode support". But Unicode letters are already correctly saved in Math as you can see in attachment. 


(In reply to Jean-Baptiste Faure from comment #2)
> Sorry Laurent, but you are wrong here, Greek letters are always saved in
> English coding in ODF files, whatever the UI language is.
Correct: I am wrong with non italic Greek letters.
But italic Greek letters are saved in the UI language. See bug 62174 or attachment: edit second formula in a French UI for instance.
Comment 4 V Stuart Foote 2015-10-12 01:29:53 UTC
(In reply to Laurent BP from comment #3)
> I do not know what is exactly "CLI Unicode support". But Unicode letters are
> already correctly saved in Math as you can see in attachment. 
> 

Of course they are, and by using the GUI as described one can currently insert Unicode glyphs into Math and then OLE embed into Writer.

But what you are asking for in implementing the <Alt>+X, and varient, keyboard shortcuts is a means of inserting Unicode directly without using the GUI--in essence a command line interface (CLI).

What is missing from the shortcut based accelerator as Justin L. implemented for the other modules would be ability in Math to categorize the inserted Unicode and if needed assign StarMath or MathML name attribute.
Comment 5 Laurent BP 2015-10-12 06:35:23 UTC
(In reply to V Stuart Foote from comment #4)
> But what you are asking for in implementing the <Alt>+X, and varient,
> keyboard shortcuts is a means of inserting Unicode directly without using
> the GUI--in essence a command line interface (CLI).
> 
> What is missing from the shortcut based accelerator as Justin L. implemented
> for the other modules would be ability in Math to categorize the inserted
> Unicode and if needed assign StarMath or MathML name attribute.
It seems I was uncleared. I 'm just expecting the same behavior as in Writer or Calc:
1. user type hexadecimal Unicode in Math editor such as "3B2"
2. user hit Alt+X (or whatever should the shortcut be)
3. LibO replaces Unicode with Unicode character β (and not any specific Math code such as %beta or %bêta in French)
No need to look for name of the character.
Comment 6 Regina Henschel 2015-10-12 07:12:31 UTC
In Windows it is useful in case the keyboard has no separate numpad or the user don't know how to enter the Unicode code point using the numpad. So yes, I think implementation in Math is useful. [The average user will not know the Unicode code point of the character. And therefore a special character dialog in Math is needed. But that is another issue.]
Comment 7 Justin L 2015-10-12 13:05:51 UTC
A proposed change to add alt-x support to math has been submitted. https://gerrit.libreoffice.org/19323
Comment 8 V Stuart Foote 2015-10-12 13:45:22 UTC
@Justin, Thanks!

Alt+X looks to be available in Math as well--so a global Shortcut assignment works there as well.

But, I guess the rub will come in how the Unicode glyph gets swapped into the formula from the command window or when visual editor is activated. Does it render? And, which font family will its metrics will be parsed from? The "customs", the "formulas" or even one of the "symbols" sets.

Could end up with some unexpected font substitutions--or the glyph simply not showing in the formula.

Will play with it once committed and a TB build rolls.
Comment 10 Jean-Baptiste Faure 2015-10-17 20:07:06 UTC
Verified fixed in Version: 5.1.0.0.alpha1+
Build ID: f1bcf41baea1636ff33f2c918ebb4a4fa589d10a
Ubuntu_15.04_x86-64
Locale: fr-FR (fr_FR.UTF-8)
built at home with gcc 5.1

Best regards. JBF