I’m converting some Graphics code to API 2.0 not by choice for the PDF engine.
When I use FontName instead of TextFont, the font never sets – even for a regular Graphics display on a canvas.
Has anyone else seen this?
Why won’t the Analyzer find these deprecation? Why did I have to run-exception-fix-repeat this? Why do I have to even do this update @Javier_Menendez ?
This is a fundamental showstopper and I’m shocked that nobody else has run into this?
No experience yet, based my comment on case #67267
myPage.FontName = "Honey I Stole Your Jumper" // the True name of the Font
// myPage.FontName = "Honey"
// myPage.FontName = "Honey.ttf" // the Filename
Hmm, in 2021 R3.1 I happily mix API2 and API1 - so the requirement to stick with API2 for everything seems to be something new (but feel free to correct me on that).
What happens if you
save a BINARY project from 2019r1 or a version BEFORE 2019r3
name it Default Desktop Project.xojo_binary_project
place it in the Project Templates directory right next to the IDE application
Now every new project will use that old form as the template and create API1 compatible projects
You might still need to edit the text file that is the project manifest (ends with .xojo_project) and change the first few lines to make it so the project opens flawless in o old version
But unless I misunderstood Tim he is talking about a graphics object. That is inside a PDFdocument but it should still be a graphics object and understand the API1 ways eg FontName instead of TextFont …
What I understand is that FontName is not working for him for PDFDocument (required) and not even for regular Graphics display on a canvas (not required).
I guess that TextFont is working for Tim on a regular Graphics display on a canvas.
I’m not sure if this is what is happening with Tim.
My other guess is that Javier did not understood Tim’s problem.
When I set the “Analysis Warnings…” options so it includes “item1 is deprecated. You should use item2 instead”, I’m getting warnings for TextFont and, in this case, also TextSize:
I’ll have to send the project in because I didn’t have either of those successful results. It’s upgrading a Shorts project, so I was expecting it to be as easy as using the existing Graphics code. At least that’s how PDFDocument’s been advertised.
Sorry to have disappeared, I wish I could have been more responsive.
Using the Graphics class methods and properties is how PDFDocument was advertised
Anyway on one of my side-projects I had to convert myself a large project from API 1.0 to API 2.0 (everything, including migrating controls to DesktopUIControls). It didn’t took me more than 4 hours using, mostly, the results from Analyze Project.
I’ve converted projects to API 2.x in short time, but when that happened everything from Xojo was working as expected. Framework functions to analyzer.
When pausing the debugger, the PDFGraphics object is showing me “Times” as the font, which as a string literal does not exist in this project, nor what I would expect from a property that doesn’t do anything at all.
Figured it out, return value of a function to associate the font name was a Variant. The actual value being returned was a String, but that was confusing FontName somehow.
Forcing a Variant.StringValue upon this code fixes the problem.