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

Default font #388

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Default font #388

wants to merge 7 commits into from

Conversation

mischnic
Copy link
Contributor

@mischnic mischnic commented Jun 4, 2018

This updates #279 to the new api.

Closes #279

params.DefaultFont = &defaultFont;
params.Width = p->AreaWidth;
params.Align = (uiDrawTextAlign) uiComboboxSelected(alignment);
textLayout = uiDrawNewTextLayout(&params);
uiDrawText(p->Context, textLayout, 0, 0);
uiDrawFreeTextLayout(textLayout);

//TODO RENAME?
uiFreeFontButtonFont(&defaultFont);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

uiDrawLoadDefaultFont behaves exactly like uiFontButtonFont in that the family needs to be freed, so uiFreeFontButtonFont needs to be called. Should there be a uiFreeDefaultFont function?

Copy link
Owner

@andlabs andlabs left a comment

Choose a reason for hiding this comment

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

Partial review for now.

darwin/drawtext.m Outdated Show resolved Hide resolved
examples/drawtext/main.c Outdated Show resolved Hide resolved
unix/drawtext.c Outdated Show resolved Hide resolved
windows/drawtext.cpp Outdated Show resolved Hide resolved
collection = uiprivLoadFontCollection();
family = uiprivFontCollectionFamilyName(collection, dwfamily);

pixels = GetDeviceCaps(GetDC(NULL), LOGPIXELSY);
Copy link
Owner

Choose a reason for hiding this comment

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

I'm not sure how correct this part is (will check again later), but I do know you're leaking the result of GetDC(NULL) here.

@cody271 cody271 mentioned this pull request Jun 6, 2018
@mischnic
Copy link
Contributor Author

mischnic commented Aug 6, 2018

Should this rather be called "system font"?

@andlabs
Copy link
Owner

andlabs commented Aug 6, 2018

Either that or DefaultControlFont.

@mischnic
Copy link
Contributor Author

mischnic commented Aug 6, 2018

Yes, control sounds appropriate

uiLoadControlFont(f);
// or
uiLoadDefaultControlFont(f);

@cody271
Copy link
Contributor

cody271 commented Aug 6, 2018

I vote for uiDrawLoadControlFont(f);

@mischnic
Copy link
Contributor Author

mischnic commented Aug 6, 2018

I vote for uiDrawLoadControlFont(f);

But "draw" is only used in function directly related to area drawing. It's also uiFontDescriptor, not uiDrawFontDescriptor.

@cody271
Copy link
Contributor

cody271 commented Aug 7, 2018

@mischnic Right, uiLoadControlFont(f); is best then.

@cody271
Copy link
Contributor

cody271 commented Aug 14, 2018

@andlabs I think this PR is now good to go, thanks to @mischnic. Anything else we need to do here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants