Windows 10 FontActivateMBS w/ Canvas.Graphics Help?

Hello,

I have a function that is using FontActivateMBS. I call this function during my App.Open event and it appears to work fine with OS X, but It is not working in Windows. My overall goal was to use this plugin function to copy over my custom font’s.

Here is what I know:

  1. In Windows 10 the remote debugger shows me that Common.fontTypeInt is 0 (no errors)
  2. My f folder native path shows as “C:\Xojo Remote Debugger\Remote Debugger Desktop\DebugVersiSync\DebugVersiSync Resources\HalisGRBold.otf” which is exactly the location of said OTF font

Is there something I am missing for Windows 10?

Thanks in advance!

// INITIALIZE FONTS
Var f as folderitem

// HALIS GR
f = TPSF.Resources().Child("HalisGRThinItalic.otf")
common.fontTypeInt=f.FontActivateMBS(True)
f = TPSF.Resources().Child("HalisGRMedium.otf")
common.fontTypeInt=f.FontActivateMBS(True)
f = TPSF.Resources().Child("HalisGRRegular.otf")
common.fontTypeInt=f.FontActivateMBS(True)
f = TPSF.Resources().Child("HalisGRLight.otf")
common.fontTypeInt=f.FontActivateMBS(True)
f = TPSF.Resources().Child("HalisGRBook.otf")
common.fontTypeInt=f.FontActivateMBS(True)
f = TPSF.Resources().Child("HalisGRBold.otf")
common.fontTypeInt=f.FontActivateMBS(True)

Ok Interesting observation I am have made. Some of my code’s text are using the correct Halis font, but some are not. Let me explain.

  1. Canvas.Paint is not using the Halis font properly for example:
g.FontName = "Halis GR Medium"
g.TextSize = 36
g.DrawingColor = Common.kVersiColor
  1. Label.Open event - Font looks correct Halis GR Light
Me.FontName = "Halis GR Light"

Weird - Thoughts?

[quote=497680:@Mike Cotrone]
Weird - Thoughts?[/quote]
Why would you want weird thoughts ? :stuck_out_tongue:

kidding

JUST For fun it you try using “Halis GR Light” for the code that uses drawstring as well does it draw right ?
If not that would seem VEERY odd as if what graphics.fontname uses to find the right font is different than the label does

NOTE this may already be the full actual name of the font - I dont know
Is “Halis GR Medium” the actual name of the font in the file (the file name and family name could be quite different) ?
if you use the actual font name does it make any difference ?

IE/ font book on mac os can show you these subtle differences

// TITLE
g.FontName = "Halis GR Light"
g.TextSize = 36
g.DrawingColor = Common.kVersiColor
Var titleOneStr as String = "Versi"
Var titleTwoStr as String = "Sync"
Var titleConcatenateStr as String = titleOneStr + titleTwoStr
Var titleConcatenateStrW as Double = g.StringWidth(titleConcatenateStr)
Var titleOneStrW as Double = g.StringWidth(titleOneStr)
Var titleOneStrH as Double = g.StringHeight(titleOneStr, 100)
Var titleOneXpos as integer = logoXpos + logoW1 + 8  //ourHeaderW/2 - titleConcatenateStrW/2
Var titleOneYPos as integer = logoYpos + 35
g.DrawString(titleOneStr, titleOneXpos, titleOneYPos)

This also fails so Ill try the actual name of the font with g.DrawString as the labels work just fine with the exact fontName call :slight_smile:

I also confirmed that Container.Paint.Graphics gives me the same bad results as Canvas.Paint.Graphics FWIW.

Something is up with Canvas.Graphics --> I added two labels onto the splash to show the contrast of the same Fonts yet different controls.

The Top ones are two labels (how I got the Halis GR Medium (green) and the Halis GR Regular (Blue)

I am not sure how Xojo handles fonts.
But it may be that Xojo gets a font list at start and then only uses fonts from that list.
A text area is a different thing.