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

setting font in TextView fails #1097

Closed
telephon opened this issue May 4, 2014 · 3 comments
Closed

setting font in TextView fails #1097

telephon opened this issue May 4, 2014 · 3 comments
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: Qt GUI sclang Qt components -- for IDE tickets, use "env: SCIDE" instead

Comments

@telephon
Copy link
Member

telephon commented May 4, 2014

(
w = Window.new("Text View Example",Rect(100,Window.screenBounds.height-400, 520,300)).front;
t = TextView(w.asView,Rect(10,10, 500,200))
    .focus(true);
t.setFont (Font("Courier",12), 5, 10);
)

Font is unchanged. w.refreshdoesn't help.

@muellmusik
Copy link
Contributor

Even odder:

w = Window.new("Text View Example",Rect(100,Window.screenBounds.height-400, 520,300)).front;
t = TextView(w.asView,Rect(10,10, 500,200))
    .focus(true);
t.string = "foobar";
)
t.setFont (Font("Courier",12), 5, 10); // only r changes!!

@telephon
Copy link
Member Author

telephon commented May 6, 2014

Also when you set the font, the color is lost and vice versa. So you can either have fonts or colors …

@scztt
Copy link
Contributor

scztt commented Jun 17, 2014

Both OP snippet and muellmusik's are correct behavior --- setFont sets the font of a range of text, in the example cases starting at 5 chars, for a range of 10. Hence the r in the second example, and nothing in the first (no text to change the font of).

This works as expected (i.e. changes base font for the view):
(
w = Window.new("Text View Example",Rect(100,Window.screenBounds.height-400, 520,300)).front;
t = TextView(w.asView,Rect(10,10, 500,200))
.focus(true);
t.font = Font("Helvetica",24)
)

Telephon is right, though - color doesn't seem to work for me. I think the fix is to switch to mergeCharFormat, which will apply the font / color to the format that's already there.

telephon added a commit that referenced this issue Jun 17, 2014
mergeCharFormat instead of setCharFormat,

so existing format info isn't obliterated. Fixes #1097.
scztt added a commit to scztt/supercollider that referenced this issue Oct 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: Qt GUI sclang Qt components -- for IDE tickets, use "env: SCIDE" instead
Projects
None yet
Development

No branches or pull requests

3 participants