-
Notifications
You must be signed in to change notification settings - Fork 614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DrawTextLayout alignment #368
Comments
The problem is that Lines 67 to 75 in 2f0e6e9
creates a frame which is smaller than Fix (not very clean): diff --git a/darwin/drawtext.m b/darwin/drawtext.m
index c04b402b..22de269c 100644
--- a/darwin/drawtext.m
+++ b/darwin/drawtext.m
@@ -76,6 +76,7 @@
cgwidth = (CGFloat) (p->Width);
if (cgwidth < 0)
cgwidth = CGFLOAT_MAX;
self->size = CTFramesetterSuggestFrameSizeWithConstraints(self->framesetter,
range,
// TODO kCTFramePathWidthAttributeName?
NULL,
CGSizeMake(cgwidth, CGFLOAT_MAX),
&unused); // not documented as accepting NULL (TODO really?)
rect.origin = CGPointZero;
rect.size = self->size;
+ rect.size.width = cgwidth;
self->path = CGPathCreateWithRect(rect, NULL);
self->frame = CTFramesetterCreateFrame(self->framesetter,
range,
self->path,
// TODO kCTFramePathWidthAttributeName?
NULL); |
I am also going to add a tiny string option to that example program, temporarily to test things like this while I don't have a more "proper" test framework (and the tester program is getting to be quite much). Not sure if I will use that exact fix or not; I forget what my previous drawtext code did. |
Lines 511 to 532 in 7891cd8
Lines 569 to 600 in 7891cd8
|
On macOS, the other alignment types don't really respect
uiDrawTextLayoutParams.Width
, but rather the longest line:The text was updated successfully, but these errors were encountered: