-
Notifications
You must be signed in to change notification settings - Fork 1.9k
DrawString doesn't work on maccatalyst #4993
Copy link
Copy link
Labels
area-drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawingplatform/ioss/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't workingt/desktopThe issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)
Milestone
Description
Description
I am using canvas DrawString method to render a text in my application. But after updating preview 13 I have faced breaking issues on setting font properties. But when I tried to set the font properties using font class, text is not visible. For android and windows, the text is rendered but the alignment is not same for the platforms.
XAML
<ContentPage.Resources>
<ResourceDictionary>
<local:GraphicsDrawable x:Key="GraphicsDrawable" />
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout>
<GraphicsView
HeightRequest="500"
WidthRequest="500"
Drawable="{StaticResource GraphicsDrawable}"></GraphicsView>
</StackLayout>
</ContentPage.Content>
C#
public class GraphicsDrawable : IDrawable
{
public void Draw(ICanvas canvas, RectF dirtyRect)
{
canvas.FontColor = Colors.Black;
canvas.FontSize = 14;
canvas.DrawString("Hello world", 10, 10, HorizontalAlignment.Center);
}
}
Steps to Reproduce
- Create a new Maui Application
- Add GraphicsView to the content page.
- Create a new class and extend the class from IDrawable
- Draw a text using DrawString using ICanvas.
- Bind the drawable to the GraphicsView drawable property.
Version with bug
Preview 13 (current)
Last version that worked well
Preview 12
Affected platforms
iOS, macOS
Affected platform versions
iOS15
Did you find any workaround?
Yes, for ios I have fixed by mapping the text to NSString in the native platform.
Relevant log output
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawingplatform/ioss/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't workingt/desktopThe issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)