Page 1 of 1

Fontsize Fontface ?

Posted: Sat Dec 28, 2019 9:33 pm
by mddmx
It's very easy to use the executeJavascript to change the font attributes

TempCode := 'document.execCommand("fontName", false, "' + FontName + '");';
Chromium1.ExecuteJavaScript(TempCode, 'about:blank');

anyone have a clue as to how I might go about retrieving the font attributes at the cursor?

Re: Fontsize Fontface ?

Posted: Sun Dec 29, 2019 2:49 pm
by salvadordf
I've never done that but I guess you can get the computed style of the selected text or its parent element.

Perhaps these answers can help you :
https://stackoverflow.com/questions/428 ... ont-family
https://stackoverflow.com/questions/744 ... ned-in-css

Once you have the font information in JavaScript you can send it to the main browser process by registering a "JavaScript extension".
See the JSExtension demo inside the JavaScript directory and read all the comments in uJSExtension.pas to know all the details.

https://www.briskbard.com/forum/viewtop ... 4084#p4084