Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 23 Jun 2017, 22:14
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
SVG/PNG Fancy Text and Logo Generator
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 8 [106 Posts]   Goto page: 1, 2, 3, ..., 6, 7, 8 Next
Author Message
vovchik


Joined: 23 Oct 2006
Posts: 1432
Location: Ukraine

PostPosted: Wed 03 May 2017, 17:02    Post subject:  SVG/PNG Fancy Text and Logo Generator
Subject description: Little application to generate stunning logos
 

Dear all,

I programmed this little app just now to generate fancy text and logos. The attached binary is Tahr 32-bit. I hope it works for you. The BaCon source is included. I used the latest bacon (www.basic-converter.org) and the latest HUG (also available at the site).

When saving, the program will deposit your time-stamped images (svg and png) in ~/txt2svg (a txt2svg dir in you home dir). There isn't really any help (yet), but the tool-tips explain pretty much everything you need to know. Experiment and have fun!

Let me know whether (or how) it works for you. Smile

With kind regards,
vovchik

UPDATED: 5 May 2017 to take into account MochiMoppel's comments.
UPDATED: 5 May 90 (evening(, to fix sefault issue and added radial gradient in simple color select (select Radial) and then set gradient colors.
UPDATED: 5 May 2015 (late evening) Added additional filters (Bevel, Distort, Shadow Drop and Warp). Warp is weird. Smile
UPDATED: 6 May (afternoon) Added a spinbox for stroke-width (thanks MochiMoppel!)
UPDATED: 6 May (late afternoon) Added LC_NUMERIC=C to source code, to ensure that SVGs get generated with periods as decimal separators. Thanks musher0!
UPDATED: 6 May (early evening) Added pattern handing. Accessed via simple named color combo box and then choosing two gradient colors.
UPDATED 7 May (just past midnight) Added another pattern (Diagonal) and included a very useful mod by Alexfish at the BaCon forum that prevents accidental exit from the program by clicking the close button in the image preview window.
UPDATED 7 May (evening) Added hatch, crosshatch and candystripe patterns.
UPDATED 8 May (afternoon) Added new filters (glass, icy, metal,)
UPDATED 8 May (evening) Added more filters, including slick shadow. Smile
UPDATED 10 May (morning) A few more filters and a fix for the bounding rectangle - which now fits and transparency when bbox is checked. Also think I understood MochiMoppel's request for stroke and fill='none'. Will work on that.
UPDATED 10 May (early afternoon) I think I have implemented what MochiMoppel has asked for. Select "Stroke only" in the Simple color select combobox.
UPDATED 12 May (evening) I added template saving and loading and made a few little enhancements.
UPDATED 14 May (evening) Added 10 new filters.
UPDATED 17 May (evening) Added 7 filters, made some changes to filter vars (now use an array).
UPDATED 21 May (evening) more filters/patterns, some code reorganization - some nice effects
UPDATED 24 May (morning) more patterns/filters, some code reorganization, better grad fills in patterns
UPDATED 25 May (after midnight) Added more filters/patterns and a tiny launch script to prevent locale problems associated with decimal delimiters in generated svg files.
UPDATED 25 May (evening) More patterns and better fills. Also no need for script launcher as SFR has kindly solved the locale problem (decimal separator) and the fix is now in the code.
UPDATED 27 May (afternoon) Added all sorts of interesting pattern fills
UPDATED 30 May (afternoon) Added more pattern fills and did some code optimization/golfing. Took into account step's suggestions.
UPDATED 30 May (early evening) Fixed a few bugs - some wrong filters being selected due to naming "conflicts" after code golfing.
UPDATED 31 May (midnight) More little bug fixes in patterm/filter naming/lookup.
UPDATED 1 June (afternoon) Fixed a few naming bugs in patterns, improved patterns, added patterns.
UPDATED 1 June (evening) Fixed/debugged some code that could have caused problems in future with added filters/patterns. Added more patterns.
UPDATED 3 June (afternoon) A few bug fixes. Additional patterns and filters.
UPDATED 5 June (evening) More patterns, some of them useful and nice. Smile
UPDATED 7 June (evening) A few patterns and added rotation and X/Y axis skewing (still working out p[lacement and autoscaling bits, but it works)
UPDATED 10 June (afternoon) Did a bit of work on calculating the bounding box after rotation. More work needed, but a start was made.
tahr-32-bit-txt2svg.tar.gz
Description  UPDATED 10 June: Bit of work done on the size of the bounding box after roation. More work needed.
gz

 Download 
Filename  tahr-32-bit-txt2svg.tar.gz 
Filesize  167.54 KB 
Downloaded  4 Time(s) 
txt2png2b1.png
 Description   
 Filesize   138.41 KB
 Viewed   955 Time(s)

txt2png2b1.png

txt2png2a1.png
 Description   
 Filesize   152.2 KB
 Viewed   962 Time(s)

txt2png2a1.png


Last edited by vovchik on Sat 10 Jun 2017, 09:46; edited 38 times in total
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1275
Location: Japan

PostPosted: Wed 03 May 2017, 22:46    Post subject:  

Well done Very Happy . So far works as advertised in my old Slacko 5.6.

Only 2 points:
- There are a lot of "Droid" fonts in the list that shouldn't be there. I don't have these fonts installed.
- I found it irritating when, after pushing the Save button, nothing seemed to happen. I expected the Apply dialog to close.
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 10309
Location: Gatineau (Qc), Canada

PostPosted: Wed 03 May 2017, 22:57    Post subject:  

HI vovchik.

I'll have a look at it.

BFN.

_________________
musher0
~~~~~~~~~~
« Un insensé sur le trône n'est qu'un singe sur le haut d'un toit. » / "A madman
on the throne is just a monkey on top of a roof." (Bernard de Clervaux)
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1609

PostPosted: Thu 04 May 2017, 09:43    Post subject:  

Hey Vovchik, very nice app!

Here's x86_64 build compiled in FD64-710, with one small modification, to preserve consecutive whitespaces:
Code:
# diff -Naur a/txt2svg.bac b/txt2svg.bac
--- a/txt2svg.bac   2017-05-03 21:13:27.000000000 +0200
+++ b/txt2svg.bac   2017-05-04 14:54:08.264041179 +0200
@@ -905,7 +905,7 @@
       "<svg xmlns='http://www.w3.org/2000/svg' version='1.1' " & NL$  & \
       "  width='" & STR$(xsize) & "' height='"  & \
       STR$(ysize) & "' " & \
-      "preserveAspectRatio='none' overflow='visible' " & NL$ & \
+      "preserveAspectRatio='none' xml:space='preserve' overflow='visible' " & NL$ & \
       "  viewBox='0 0 " &  STR$(xsize) & " " & \
       STR$(ysize) & "' " \
       "opacity='" & opacity$ & "'>" & NL$ & ff$
#

FYI: for an unknown reason the binary I built used to segfault after clicking "Apply" button, until I tuned on optimizations ('-O1' or higher).
I ended up with '-Os' + strip + UPX.

Also, having txt2svg binary in HOME and trying to save a logo produces another segfualt, because the output dir shares the same name as the binary.

EDIT: Txt2Svg is now available in Fatdog's repo.

Greetings!
txt2svg-2017.06.01-x86_64-1.txz.gz
Description  Remove fake .gz!
MD5: b33864d9bc66fd609ae9f2ed68914c36 txt2svg-2017.06.01-x86_64-1.txz
gz

 Download 
Filename  txt2svg-2017.06.01-x86_64-1.txz.gz 
Filesize  97.23 KB 
Downloaded  31 Time(s) 
txt2svg.jpg
 Description   
 Filesize   58.8 KB
 Viewed   892 Time(s)

txt2svg.jpg


_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.

Last edited by SFR on Thu 01 Jun 2017, 13:30; edited 10 times in total
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1432
Location: Ukraine

PostPosted: Thu 04 May 2017, 10:33    Post subject:  

Thanks guys.

@MochiMoppel: You are right about Droid. Not everybody has it and I have already implemented a parser that will chose a default from among a few common ttf fonts in this order:

Quote:
Droid Sans|DejaVu Sans|Liberation Sans|Ubuntu|Sans|Arial|FreeSans


I will post an update soon. I also think I should dismiss the image window after a save, so I will implement that in the same update. Smile

@SFR: I am really glad you caught that. One of the GNU Colbol developers had exactly the same problem with txt2svg and you solved it. Thanks. The reason I did not notice is that I always use the following command line for everything BaCon:

Quote:
bacon -o -Os -o -fdata-sections -o -ffunction-sections -o -Wl,--gc-sections "$mybacfile"


so it did not occur to me that others may not be using those arguments (bad me Smile).

In any case, I am glad that you got it to work and posted the binary. I have also included your "preserve" for whitespace. Thanks.

Those changes will be in the update (in the first post), as soon as I do a few more tests and think about rotation and some additional filters. Soon, I think.Smile

With kind regards,
vovchik

PS. Relief and Solidify do some incredible things. If you have some nice filters on hand, please post.
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1432
Location: Ukraine

PostPosted: Fri 05 May 2017, 04:16    Post subject:  

Dear all,

I have updated the app, taking into account MochiMoppel's comments. Default font handling is now better, and combo lists are now alphabetized. Also, the display window closes after a save. Next in line is the inclusion of axis scaling and skewing and matrix transforms.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 4583
Location: New Zealand

PostPosted: Fri 05 May 2017, 04:51    Post subject:  

Excellent. Very useful.
Should I be concerned about the following message when I run from terminal? -
Code:
** (txt2svg:5073): WARNING **: Invalid borders specified for theme pixmap:
        /usr/share/themes/ShallowThought/gtk-2.0/radio5.png,
borders don't fit within the image
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1432
Location: Ukraine

PostPosted: Fri 05 May 2017, 05:59    Post subject:  

Dear greengeek,

Thanks. That message is innocuous. It happpens because there might me some oddity in the theme. Txt2svg is not the cause, since it uses for GTK whatever the user has selected as a theme. Smile I get the same with some themes, too. Most other GTK2 applications would also give you that error/warning, but you can safely ignore it.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1609

PostPosted: Fri 05 May 2017, 06:39    Post subject:  

@Vovchik: thanks for the update. I've updated the binary for Fatdog in my previous post.

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1432
Location: Ukraine

PostPosted: Fri 05 May 2017, 07:56    Post subject:  

Dear SFR,

Thanks. As for the naming of the image dir in $HOME, I am open to suggestions. If it is a hidden dir (using a dot), it will require a user to unhide it each time he wants to check on the files produced. In a normal installation and once packaged, as you well know, it would typically be in /usr/bin or /usr/local/bin, $HOME/bin or $HOME/opt, so the conflict wouldn't noramally arise. But, it can happen, so perhaps naming the image dir "txt2svg_img" or something like that might be better. I am wondering...

With kind regards,
vovchik

PS. If we can get skewX, skewY, matrix and scaling incorporated and working nicely, we should be able to generate some pretty amazing texts. I am now playing with those things.
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1609

PostPosted: Fri 05 May 2017, 08:47    Post subject:  

Well, I thought of renaming that dir to e.g. "Txt2Svg", but you're right - the binary shouldn't be in HOME in the first place.
So, I did create a regular TXZ package for Fatdog and problem solved. Wink

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1432
Location: Ukraine

PostPosted: Fri 05 May 2017, 14:47    Post subject:  

Dear all,

There is a new update in the first post. Peter van Eerten, author of BaCon, determined why the segfault was occuring and provided a real fix (source and binary for Tahr updated):

Quote:
I was able to reproduce this segfault now. It turns out that the function 'pango_layout_get_pixel_size' was (a) wrongly defined and (b) wrongly used Smile

The error relates to the way C refers to pointer variables. When the ADDRESS function is used without proper pointer definitions then GC will simply see two large numbers, while it needs addresses to store values. In the latest source code, the following has to be adapted.


Line 380:

IMPORT "pango_layout_get_pixel_size(long,int*,int*)" FROM pango$ TYPE void


Line 503:

pango_layout_get_pixel_size(layout, &l_width, &l_height)


Now the program works also without optimization flags.


I have also implemented radial gradients for text and backtround, but this option is activated by selecting "Radial" in the colors combos. It was easier (faster) to implement this way, without having to rearrange the gui. Smile The attached image shows radial gradients for font and background.

With kind regards,
vovchik
txt2png3.png
 Description   
 Filesize   76 KB
 Viewed   748 Time(s)

txt2png3.png

Back to top
View user's profile Send private message 
jafadmin

Joined: 19 Mar 2009
Posts: 634

PostPosted: Fri 05 May 2017, 15:42    Post subject:  

Works on Precise 5.7.1

Very nice hack, as always, vovchik ..
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 10309
Location: Gatineau (Qc), Canada

PostPosted: Fri 05 May 2017, 17:14    Post subject:  

Hi vovchik.

Works on DpupStretch-7.0.0a1... generally.

If you type text on two lines, one line disappears.

BFN.
root_20170505_17h00m51s_switzera_adf-56-shine.png
Description  On one line, it's ok.
png

 Download 
Filename  root_20170505_17h00m51s_switzera_adf-56-shine.png 
Filesize  10.77 KB 
Downloaded  20 Time(s) 
Hum...jpg
Description  Here, the 2nd line is lost.
jpg

 Download 
Filename  Hum...jpg 
Filesize  145.24 KB 
Downloaded  24 Time(s) 

_________________
musher0
~~~~~~~~~~
« Un insensé sur le trône n'est qu'un singe sur le haut d'un toit. » / "A madman
on the throne is just a monkey on top of a roof." (Bernard de Clervaux)
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1432
Location: Ukraine

PostPosted: Fri 05 May 2017, 17:40    Post subject:  

Dear musher0,

Thanks for testing. The reason that line disappears is that Switzera ADF is a badly behaved font - the size tables were done badly by the designer, most probably. But that is why, at the very bottom right there is a spin box to fix the offsets. Click on the y offset and add some 15 or 20 pixels (or subtract, as the case may be) and you will see the top line. And in those cases where the font spills over or gets clipped, do a manual adjustment of the dimensions (lower left) of the image. Those things happen because something goes awry in the box calculations being done by pango. I assume the pango guys got it right (algorithm based on ttf specs) and the font designers did not striclty adhere to them.

I am about to post an update that contains four additional filters (Bevel, Distort, Shadow Drop and Warp). With fat fonts, such as Switzera ADF, the results are funny and weird.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 8 [106 Posts]   Goto page: 1, 2, 3, ..., 6, 7, 8 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1032s ][ Queries: 14 (0.0111s) ][ GZIP on ]