Text Formatting Codes

For everything that's not in any way related to PureBasic. General chat etc...
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Text Formatting Codes

Post by chris319 »

I am working on a video titling program written in PureBasic. I need a way to embed text formatting in my lines and pages of text.

They will govern whether a row of text is centered, aligned left or right, whether a page of text is centered vertically or top or bottom aligned, character colors and sizes, borders or drop shadows on characters, page background colors, etc.

What would be my best bet? HTML tags? RTF control characters? Come up with something else of my own devisement?

Thoughts?
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Text Formatting Codes

Post by wilbert »

Windows (x64)
Raspberry Pi OS (Arm64)
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Text Formatting Codes

Post by IdeasVacuum »

It depends on how you plan to embed the text into the video media. I assume you will write the text on an image and then add that image as extra frames to the video. In that case, something similar to BBCode is fairly easy to write translation code for.

However, if you are drawing text on an image, why not make that input dynamic, in a similar way to email and word processor apps? If you write directly onto an image, that would be easiest I think.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: Text Formatting Codes

Post by chris319 »

The user will edit the text on screen and will then be able to save it as a bmp or jpg image. He can then encode it to a video format and edit into his video, overlay it, etc. It won't be embedded into video frames by my program. What I need to do is store the text in files so the user can retrieve them.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Text Formatting Codes

Post by IdeasVacuum »

So, the User input should be direct to an image, and that input must be saved as a text file for later recovery. I think your own BBCode would be perfect. It's possible that the User might want to include square brackets [] in the text, so you need a robust method to escape 'special' characters behind the scenes. Sounds like a fun project 8)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: Text Formatting Codes

Post by chris319 »

The program is the outgrowth of another program written rather hastily a couple of years ago. It was written just to get some usable titles for a friend's documentary video. All of the text was hard-coded in the interest of expedience.

It used to write to an image but I was having issues with font jaggedness, so it now draws directly to a windowed screen where Windows handles the screen-font smoothing.

For BBCode I may use a different delimiting character such as ~

I am posting an even simpler program to Tricks 'n' Tips which uses a large editor gadget. It didn't take much programming to have interactive text entry, but there is only so much you can do with an editor gadget. For example, you can't have borders around characters.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Text Formatting Codes

Post by IdeasVacuum »

Hi chris319

If you are Windows only, then the answer to poor graphics text is GDI+.
Danilo made a superb lib:
2DDrawing commands with AntiAliasing through GDI+
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: Text Formatting Codes

Post by chris319 »

Thanks, IdeasVacuum -

I will definitely look into Danio's library.
Post Reply