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?
Text Formatting Codes
Re: Text Formatting Codes
I would suggest HTML or BBCode.
https://en.wikipedia.org/wiki/BBCode
https://www.bbcode.org/reference.php
https://en.wikipedia.org/wiki/BBCode
https://www.bbcode.org/reference.php
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Text Formatting Codes
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.
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.
If it sounds simple, you have not grasped the complexity.
Re: Text Formatting Codes
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.
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Text Formatting Codes
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
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Text Formatting Codes
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.
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.
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Text Formatting Codes
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+
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.
If it sounds simple, you have not grasped the complexity.
Re: Text Formatting Codes
Thanks, IdeasVacuum -
I will definitely look into Danio's library.
I will definitely look into Danio's library.