Thanks both. I am aware of UIImage's baseline and alignmentRectInsets; is there anything else?
Looking at the example of chevron.compact.down, on an @3X device I see:
UIImage.size = 70.33 x 25.67
CGImage.size = 163 x 43
UIImage.alignmentRectInsets = left 0 right 0 top -25 bottom -25.67
UIImage.baselineOffsetFromBottom = -10.33
I don't immediately see how I can apply the insets and/or baseline to one size to get the other!
I am attempting to draw the symbols into what will eventually be a texture atlas for GPU use. I am not particularly concerned about most of the typographic properties but I do need the symbols to have the correct aspect ratio and the correct relative sizes. So after the code above I did something like
CGRect R = CGRectMake(0,0, img.size.width,img.size.height);
CGContextDrawImage(context, R, cgimg);
That results in wrong aspect ratios. So now I do:
CGRect R = CGRectMake(0,0, CGImageGetWidth(c), CGImageGetHeight(c));
CGContextDrawImage(context, R, cgimg);
Now the aspect ratio is correct, but the image is much larger - and not by a factor of img.scale (== mainScreen.nativeScale), it varies near 2.5.
When I run on an @2X device, the UIImage sizes are almost the same (e.g. 70.5 instead of 70.33) but the CGImage sizes are smaller - they are, I think, exactly 2/3 of the size of the @3X image sizes.
I think I trust that the size of the UIImage will be related to the font size that I ask for in the UIImageSymbolConfiguration in a stable way, but I don't trust that the CGImage size is consistent with the font size in the same way. I almost trust that it will be consistent if I divide the CGImage size by img.scale.
What should I do?