0

I am trying to display subtraction of 2 numbers with the subtraction symbol &minus; to no success. It works when i simple use - but that is not how a subtraction symbol should look like. I've tried with &mdash;, &divide;, &multiply; with no success. Is there a way to display these symbols in SVG within the <text> tag?

echo '<text x="165" y="'.$y_axis.'" font-size="30"
     font-family="Arial, Helvetica, sans-serif"
     fill="rgb(93, 130, 255)">
     &minus;</text>';
Joe Shamuraq
  • 1,245
  • 3
  • 18
  • 32
  • As a [unicode character](https://www.fileformat.info/info/unicode/char/2212/index.htm) perhaps. − is a HTML thing as are all the other entities. – Robert Longson Feb 18 '20 at 16:14
  • yes i'm beginning to think so too but what are the unicode characters acceptable in SVG? – Joe Shamuraq Feb 18 '20 at 16:17
  • All of them that you have a font for. – Robert Longson Feb 18 '20 at 16:24
  • Given that the `-` is actually the minus symbol and part of the basic set of universal characters, I see no reason why you do not simply put `-` in the svg area. Its not like you are trying to do something like ™ or © which requires something above basic ascii. – IncredibleHat Feb 18 '20 at 16:39
  • Yes i agree with you as a laymen approach but apparently it is not an acceptable symbol in a 'Math' environment. It just amazes me how these people can see the difference... – Joe Shamuraq Feb 18 '20 at 16:48
  • Does this answer your question? [Character entities in PHP and SVG](https://stackoverflow.com/questions/59474432/character-entities-in-php-and-svg) – r3mainer Feb 18 '20 at 16:51

1 Answers1

0

Instead of HTML Entity (named): &minus; it must be in HTML Entity (HEX): &#x2212;. The same format applies to other symbols.

Joe Shamuraq
  • 1,245
  • 3
  • 18
  • 32