This question already has an answer here:

How to write subscript or superscript labels in QGIS 3.4?

Is there any function to do it without any external involvement like Character Map or etc?

I'm EXPLAINING that this is not a duplicate question and I want to use those scripts not only in MAP LAYOUT but everywhere!

For example like this below ▼ enter image description here

marked as duplicate by Mapperz Feb 26 at 15:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @Mapperz this is not a duplicate! Read more carefully! Am I asking about legend here? I've searched a lot and want to hear about QGIS3 and scripting in expression! I know your linked question and many others but they are not ok in my case! – Vitruvius Feb 26 at 15:17
  • 1
    Is the following link any help? gis.stackexchange.com/questions/181287/… – Carlos Feb 26 at 15:20
  • @carlos that script is obsolete for QGIS3!!! it works only with numbers and only superscript part. Subscript part shows errors in python console. That is not a solution... – Vitruvius Feb 26 at 15:22
  • 2
    It is not.... First off you would need to add further unicode supscript and subscript samples for the whole alphabet. Secondely to fix subscript you need to change the 'outputText += unichr(charPos + 8320)' line to 'outputText += chr(charPos + 8320)'. – Carlos Feb 26 at 15:30
  • 1
    There are however some letters missing in unicode so I would advise searching for a python module which can handle the whole alphabet. Maybe sympy will do the trick. – Carlos Feb 26 at 15:44

Browse other questions tagged or ask your own question.