Points vs Pixels [Web/Console]

It seems that the Desktop version of XOJO support multiple TextUnit values (Point, Pixel, Inch, CM)
but this is NOT available in the WEB or CONSOLE versions…

Is this an oversight of Xojo part? Is there a technical reason it was omitted?

The PDF class I wrote uses POINTS (because that is how PDF rolls, and I wanted the graphics stream to have a consistent look), but with PIXEL seeming to be the default for WEB/Console, the text is drawn at a different size in relation to all other output.

Check http://www.w3schools.com/cssref/css_units.asp for currently supported units on the web.

Thanks , but that wasn’t my question…
My question is why doesn’t XOJO console/web support TextUnits? and how does one deal with it when the incoming data is in POINTS in such a way that Web/console produce appropriate output…

Although that link seems to infer that

pixels=(points/72)*96

Point on the web is just the same as 1/72th inch pixel. See “Absolute Lengths” at the bottom of the page I linked to. Was not your question "Points vs Pixels " ?

HiDpi is taken into account by this note :

In Apple’s terminology, it would seem that web px = point. But the web does not seem to have any way of finding out if the client uses more than 1/72th an inch resolution.

Console (and by extension web) use a different drawing engine which only supports pixels

Ok… here in lies my confusion

Run on OSX - returns 92:118 for both points and pixels
Run on Win10 returns 124:175 for points and 93:133 for pixels
Run as OSX Console return 116:124
when run as Win Console, it didn’t stop so I could see the results

Forced font to COURIER (above was “System”)
Run on OSX - returns 60:100 for both points and pixels
Run on Win10 returns 80:143 for points and 60:107 for pixels
Run as OSX Console return 68:105

I would have expected that OSX desktop and console to return the same values
and I would expect Windows to not be “far” off, realizing it is a diff platform and font file
but I would expect SIZE to matter :slight_smile:

  Dim p As New picture(32,32,32)
  Dim g As graphics=p.graphics
  Dim s As String
  Dim t As String
  Dim m As String
  #If TargetWindows
    m="Windows"
  #EndIf
  #If TargetMacOS
    m="OSX"
  #EndIf
  #If TargetConsole
    m=m+"[console]"
  #else
    m=m+"[Desktop]"
  #EndIf
  g.TextUnit=FontUnits.point
  g.textsize=100
  s="Points "+Str(g.StringWidth("W"))+":"+Str(g.TextHeight)+"/"+Str(g.TextSize)
  g.TextUnit=FontUnits.Pixel
  g.textsize=100
  t="Pixel "+Str(g.StringWidth("W"))+":"+Str(g.TextHeight)+"/"+Str(g.TextSize)
  
  msgbox m+EndOfLine+s+EndOfLine+t

textunit lines were commented out for console run