Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Fontsize Fontface ?

Post Reply
mddmx
Posts: 14
Joined: Fri Dec 13, 2019 2:42 pm

Fontsize Fontface ?

Post 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?
User avatar
salvadordf
Posts: 4572
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Fontsize Fontface ?

Post 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
Post Reply