-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] FreeType-based text renderer (-out=spupng with teletext/EIA608) #877
Conversation
This is looking good. 🙂 Okay, so couple of questions and points :
This question is important because these are directly displayed as it is by video players at the position defined by the XML file. For example : So, if they are of transparent bg, they might not be visible properly, and if the complete rectangular frame is black : they might cover full regions. This is how usual SPUPNG png looks : Notice how only the text has filled bg?
|
Sure!
I think the PNGs like the following would be perfect. They can then be placed anywhere on the screen (with the help of respective XML file).
If you're not including those changes in this PR, do remember to raise an issue once this is merged so that we don't forget it later on. 😉 |
A sample of generated xml is attached. |
Please use relative path in XML instead of full path :
Also, could you also show how the new pngs look? Attach them here. |
The images in the PR has updated to the new pngs. New xml file sample: teletext.zip |
src/CMakeLists.txt
Outdated
@@ -52,6 +52,7 @@ include_directories ("${PROJECT_SOURCE_DIR}/extractors/") | |||
include_directories ("${PROJECT_SOURCE_DIR}/wrappers/") | |||
include_directories ("${PROJECT_SOURCE_DIR}/libpng/") | |||
include_directories ("${PROJECT_SOURCE_DIR}/zlib/") | |||
include_directories ("${PROJECT_SOURCE_DIR}/freetype/include") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add trailing slash. It doesn't include all files without it.
src/lib_ccx/ccx_encoders_spupng.c
Outdated
#define FONT_PATH "C:\\Windows\\Fonts\\calibri.ttf" | ||
#else | ||
#define FONT_PATH "/usr/share/fonts/truetype/noto/NotoSans-Regular.ttf" | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing font for macOS. Results in
Failed to init freetype when trying to init face, error code: 1
Error: Cannot write teletext2.d/sub0000.png: No such file or directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The font problem is actually one of the issue. I didn't fix it because I think it's part of customization. But yeah, I will fix it now, by adding an option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please allow a parameter to pass the path of font in case the default one is missing, changing path in code is not desirable.
I tried couple of fonts and for some reason the pngs generated were quite pixelated - is it normal?
Looks like text justification is not really making things neat. It leads to words breaking in newlines which doesn't contribute much to readability.
Let the text be as it is, do not justify it.
@harrynull Also it'd would have been better if you commented instead of changing description because, first, it tampers the history and comments seem senseless, and second it's easier to follow things. From next time always comment. |
@saurabhshri |
Nevermind, it's a bug related to my black background algorithm. I've fixed it. |
mprint (" comments in the XML file.\n"); | ||
mprint (" -font: Specify the font that is used when generating png files\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change it to Specify the full path of the font that is to be used when generating SPUPNG files
.
@cfsmp3 Once that parameter description is edited, it's good for merge, thanks @harrynull - nice job! :) |
Please prefix your pull request with one of the following: [FEATURE] [FIX] [IMPROVEMENT].
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
ABSTRACT
The pull request implements a FreeType-based text renderer, which can be used to generate the bitmaps for spupng in the case of teletext/EIA608.
CHANGES
KNOWN ISSUES
Note that the issues will also affect EIA-608 which may not have these issues before (But the new implementation is generally much cleaner, easier to maintain and more extensible and customizable than the old one).
Font needs to be manually set.FIXED (New option -font added to specify font)Characters like "$" will be cut.FIXEDAccented letters don't render. (could be encoding problem)FIXEDNOTE
Please merge this PR after #876 , or it won't compile.
EXAMPLES
Note that the preview is not latest. Please refer to comments for the latest preview.
Example of a good output.
Example of tag rendered as-is.
![sub0000](https://user-images.githubusercontent.com/7413706/34639001-3e7d4ae2-f312-11e7-806b-b92c4d739b7b.png) (original generated png file) ![sub0000](https://user-images.githubusercontent.com/7413706/34639115-71ab680c-f314-11e7-8c70-5f75801d7dbe.jpg) (transparency is replaced by black) Example of "$" being cut.FIXED