How to hit any letter using Unicode in Java

In my Java application, I want to output hatched letters (e.g. html tag). Is there a way to do this using Unicode (concatenation)

+6
source share
4 answers

No, It is Immpossible. Although there is the concept of the stroke as diacritical , it is not available as a separate Unicode character, probably because the different letters that use the diacritical stroke do not place it at the same height or even at an angle. Thus, the result will not look like strikethrough markup.

To output lowercase text in Java, you need to use an output format that allows explicit markup. If you have a Swing app, you're in luck as many Swing components support HTML . Otherwise, it depends on what presentation technology you use.

+3
source

To accomplish this task, you can use U + 0336 by combining a long stroke overlay.

For comparison, U + 0336 looks here compared to the html <strike> :

Republic of South Africa, Hypertext Tag

One note: if you look closely at the “m” in the “combination” above, you are likely to see a small gap in the strike due to how the combination of overlay labels works. For this reason, you still need to use html or other technology on U + 0336 for this purpose, if you have this option.

+4
source

As already mentioned, Unicode does not, but many Swing components understand basic HTML tags.

 JLabel label = new JLabel("<html><s>My stroke</s></html>") 
+3
source

Not. Unicode does not define an out mark combination. The Unicode view is that it is a markup job - like HTML.

+2
source

Source: https://habr.com/ru/post/894198/


All Articles