Jump to content
Server Maintenance This Week. ×

Style Manipulation


This topic is 7271 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I've added an *in-progress* style-manipulation example to my website:

http://www.spf-15.com/fmExamples/

I didn't include it as an attachment since it still needs quite a bit of work.

It makes heavy use of custom functions to show how style information can be obtained and manipulated. As a result, there is little point in downloading this example unless you have FM Dev 7.

The three examples I've implemented in this file:

- Visine: remove all redness from a piece of text, leaving other colors unaltered.

- RedToBlue: Moves the red component of all text to the blue component, green is unaltered.

- ItalicToBold: Changes all Italic text to Bold, all other formatting information is unaltered.

These all work by manipulating the style information obtained via the GetAsCSS() built-in, and there are numerous custom functions to assist in breaking apart the style information embedded there.

Limitations / in-progress:

- htmlDecode: I've only implemented the absolute minimum so far, so it doesn't completely undo the html encoding of special symbols GetAsCSS() does.

- subscript / superscript: These two manipulate the font point-size as well as the style in CSS, and I haven't determined precisely how to recognize them yet.

Any assistance or suggestions would be appreciated.

Link to comment
Share on other sites

I've now added support for most accented characters in htmlDecode(), that was a little trickier than I thought, since the html escape codes are case sensitive for those.

I've also worked around my troubles with subscript / superscript. GetAsCSS() gives two "font-size" numbers when the text isn't at the default size. I reported this to FMI as a bug.

The latest version (on my website) also has a variety of functions to extract text out of HTML data using tag names, which could be used in conjunction with the style methods to pull styled text from a website.

http://www.spf-15.com/fmExamples/

Link to comment
Share on other sites

This topic is 7271 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.