Skip to content
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

Remove EbrCenterTextInRectVertically #1882

Merged
merged 4 commits into from
Feb 1, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions Frameworks/UIKit/UITabBarButton.mm
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,14 @@ - (void)drawRect:(CGRect)pos {
id font = [UIFont defaultFont];
size = [title sizeWithFont:font constrainedToSize:CGSizeMake(0.0f, 0.0f) lineBreakMode:UILineBreakModeClip];

CGRect textRect;
textRect.origin.y = rect.size.height - size.height;
CGRect textRect{};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're gonna do this, y'might'swell fold the following statements into the initializer.


// Horizontally center text
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vertically?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you 😪

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double sign off!


In reply to: 98794256 [](ancestors = 98794256)

textRect.origin.y = (rect.size.height - size.height) / 2.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably worth commenting that we're vertically centering this

textRect.origin.x = rect.origin.x;
textRect.size.width = rect.size.width;
textRect.size.height = size.height;
// TODO(DH)
// EbrCenterTextInRectVertically(&textRect, &size, font);

CGContextSetFillColorWithColor(context, (CGColorRef)[UIColor whiteColor]);
CGContextSetFillColorWithColor(context, CGColorGetConstantColor(kCGColorWhite));
size = [title drawInRect:textRect withFont:font lineBreakMode:UILineBreakModeClip alignment:UITextAlignmentCenter];
}
}
Expand Down
9 changes: 0 additions & 9 deletions Frameworks/UIKit/UITextView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -757,15 +757,6 @@ - (CGSize)sizeThatFits:(CGSize)fitSize {
CGSize fontExtent = { 0, 0 };

fontExtent = [[self _text] sizeWithFont:(id)_font forWidth:rect.size.width lineBreakMode:UILineBreakModeWordWrap];

CGRect centerRect;
centerRect.origin.x = 0;
centerRect.origin.y = 0;
centerRect.size = fontExtent;
// TODO(DH)
// EbrCenterTextInRectVertically(&centerRect, &fontExtent, _font);
rect.origin.y += centerRect.origin.y;

ret.width = ourRect.size.width;
ret.height = fontExtent.height + _marginSize * 2.0f;

Expand Down