It looks like some characters are not displayed in the OmegaT UI, regardless of the font used.
I tried to use an emoticon (U+1F607 - π) in the "match prefix" preference and it was not displayed in the preference UI, and was not displayed either in other prefs (paragraph delimiter, for ex). It is not displayed in the segment display either.
The emoicons are placed on Supplementary Multilingual Plane in Unicode standard table.
It is expressed in Surrogate-pair , 2 Character objects, in Java UTF-16. It may be a reason why it does not work properly.
Do you think there is an easy way to fix this ?
The cause is a font.
Very limited font can display emoicons on Java.
Many applications such as a web browser replaces emoji char in Unicode to graphics.
OmegaT just display it with java font.
Please see an attachment. That is OmegaT screenshot that use a special custom theme, the feature recently included in Nightly build.
I uses "Dialog" font that has a emoicons to demonstrate it.
I uses Linux for development, I've installed many fonts but only 11 font can display emoji.
DejaVu Sans
DejaVu Sans Condensed
DejaVu Sans Condensed Oblique
DejaVu Sans Oblique
Dialog
DialogInput
Monospaced
Noto Color Emoji
SansSerif
Serif
Unifont Upper
Number of fonts=11/2659
You can try a plugin attached which configured to use DejaVu Sans on Nightly OmegaT, and please download and install DejaVu Sans font on your OS.
https://dejavu-fonts.github.io/Download.html
preference -> appearance -> theme
change theme to Flat Round Dark
then Project -> restart
OmegaT team can bundle a font such as DejaVu Sans as a fallback, and it can check system fonts when launched and if there is no good font, use fallback one for input dialog.
Here is a short scratch program to detect a font which can display emoicons.
Last edit: Hiroshi Miura 2021-06-23
The plugin project is https://github.com/miurahr/omegat-round-theme
I've modified the plugin as follows;
OmegaT can do similar thing on DefaultFlatTheme.java
This is also a font issue. I've push the Pull-Request to allow users to select a proper font.
https://github.com/omegat-org/omegat/pull/117
Attached file is a test source for trasnlation that has emoticons.
You can check your font can display emoji on OmegaT.
I'm sorry, Hiroshi, but I think you're barking up the wrong tree.
First, Java Swing has limited text rendering capabilities and simply can't render a lot of emoji (especially composed ones like ZWJ sequences or region flags). It doesn't support the Apple Color Emoji font, so on Mac it will never give you the same rendering as native applications.
For single-codepoint emoji, if you have a font that provides a glyph for that emoji (suggstion: Noto Emoji but not Noto Color Emoji on Mac, as it is not supported), then in theory Swing should manage to fall back to that font, but in practice it often doesn't. For those cases in the Editor pane we have the Aggressive Font Fallback feature, which will go character-by-character and attempt to locate and apply a supporting font.
Outside of the Editor pane, we would have to apply the Aggressive Font Fallback feature to literally every textbox in the application. This is super invasive and I don't really want to do it. If someone wants to look into a nice way to do it, go ahead.
One problem with Aggressive Font Fallback is that it is currently broken on Java 11; see [#1051].
Hiroshi's strategy to address this issue is just not a good solution:
It's bad UI/UX:
You should not need to choose a particular default font to get particular glyphs to show; that is supposed to be handled by font fallback.
If we accept that we have to do extra work because Swing sucks at font fallback, the logical result of that is the Aggressive Font Fallback feature (where only codepoints that need it get manual fallback), not making the user choose a particular font that prioritizes a particular set of codepoints.
Why emoji? Why do they warrant a special feature in the Font preferences? What about any other set of codepoints that Swing fails at, like Egyptian Hieroglyphs or Mathematical Alphanumeric Symbols?
I think this will only be fundamentally solved by either Java Swing getting major updates (probably not happening) or us porting OmegaT to a different UI framework like SWT.
Related
Bugs:
#1051Thank you very much @miurahr9 and @amake for the discussion and the attempts at fixing this. It is definitely not a priority as it does not impair any work in OmegaT. I'm fine with closing the issue.
It's a legitimate issue, so I am happy to keep the ticket open.
When we can find a way to detect a good font or fix Aggressive Font Fallback on Java 11, we can set it
UIManager.put('TextField.font', font)
in themes.I'd like to address to [#1051].
Related
Bugs:
#1051Last edit: Aaron Madlon-Kay 2021-06-28
FYI: recent OpenJDK accept an interesting patch to support Emoji.
JDK-8263583
8263583: Emoji rendering on macOS
FYI: Emoji rendering on Linux is not fixed yet
JDK-8268806
After complete the implementation of [#1069], we can put images on editor panes.
Here is a simple idea that we can put emoicon image with
<img src="data:base64,brabra">
for alternative of emoji character code.Related
Feature Requests:
#1595Last edit: Aaron Madlon-Kay 2021-09-22
Now this looks working on OmegaT nightly on Java 11 on Linux. See attachment.
@brandelune Could you try Nightly with Java 11?
I think it has been solved by #1051 resolution.
OpenJDK 21 introduce Unicode Emoji Properties API.
https://github.com/openjdk/jdk/pull/13006
The proposal is merged and released in JDK21.
JDK21 has Unicode EMOJI property
https://jdk.java.net/21/release-notes#JDK-8303018
Ref: Unicode Standard, Emoji Specification https://unicode.org/reports/tr51/
We can advice to users to use Java 21 or later when user want to use EMOJI for any configuration.
Unfortunately, emoji check is supported in Java 21 or later.
We can define regex to identify emoji in Java 21 or later.
https://jdk.java.net/21/release-notes#JDK-8305107
Java 17 on macOS seems supports to show emoji character, but windows and linux is not.
I'd like to postpone milestone to future release.