Question

ok, the title is a bit confusing. I have a subclass of webview. i can type in it. now, if I change the font from the fontpanel, or the color from the colorpanel while having nothing selected, and then i type a character, this new character would be in the new font or the new color. if I change the font from a popupbutton, then set the selectedfont in the nsfontmanager, when i type a character, the font resets back to the font of the previous character.

is there a way to keep this "temporary" font or color change?

Was it helpful?

Solution 2

i finally figured it out. i looked at the source code of webkit to see what happens on changeFont: and changeColor:. it checks if you changed the font by converting two predefined fonts, and checking for common properties. so i subclassed nsfontmanager, and wrote a simple override for convertFont:, so webkit could understand that i did change the font, and it kept the "temporary" font.

OTHER TIPS

I just looked at the Webview Class Reference docs and it doesn't seem like you can do that. You have to do it the first way, every time, to achieve what you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top