REALGetPropValueString for Font Class to get name fails

I get failures reading the Name of a Font object on iOS.
The Size property works for me.

Code like this:

	if (RealbasicVersion() >= 2020)
	{
		REALobject font = nil;
		if (REALGetPropValueObject(o, "Font", &font))
		{
			FreeLater(font);
			
			if (REALGetPropValueString(font, "Name", &TextFont))
			{
				// okay
				return TextFont;
			}
			else
			{
				DebugMessage("Failed to query Name property of font.", font);
			}
		}
		else
		{
			DebugMessage("Failed to query font property");
		}
	}

So we get font property from Graphics on iOS and query name. Name fails for some unknown reason.

@William_Yu, you have an idea?

Maybe you need the graphics.Font as string?
Not sure if font is supported on ios.

https://documentation.xojo.com/api/graphics/graphics.html#graphics-fontName

There is no FontName for iOS.
But a Font property and that doesn’t have a name for some reason.

1 Like

It seems there is missing a crucial part in ios then.

Yes, apparently Graphics.Font is returning an iOSFont object instead, we’ll get that fixed.

<https://xojo.com/issue/62908>

But there is iOSFont and Font. Both have a name property, but I can’t get it!?

Yes but for iOSFont the Name is of type Text (so you would need to use REALGetPropValueText) while for Font it is a String.

Thanks. REALGetPropValueText seems to work, but looks like I currently can’t change the font on graphics as I can only assign Font, not iOSFont.