SVG/PNG Fancy Text and Logo Generator

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#61 Post by vovchik »

@ all: Updated, added more effects (filters/patterns) and reorganized some code.
Attachments
vovchik_20170520_12h59m04s_droid_sans-218-slick-shadow.png
(126.35 KiB) Downloaded 530 times
vovchik_20170520_13h19m41s_wc_fetish_bta-165-slick-shadow.png
(172.31 KiB) Downloaded 514 times

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#62 Post by vovchik »

@ all: added more patters and effects, fixed up some filters in respect of color fills/gradients, reconfigured patterns vars as a string array. The revised source and a 32-bit Tahr binary are in the first post.
Attachments
vovchik_20170525_10h14m48s_tannenberg_fett-167-fluid-fantasy.png
(98.8 KiB) Downloaded 365 times
vovchik_20170524_15h27m47s_creepy-153-lumi.png
(161.08 KiB) Downloaded 437 times
vovchik_20170522_15h51m29s_droid_sans-211-outline-black.png
(72.13 KiB) Downloaded 454 times
vovchik_20170523_01h02m25s_whimsy_tt-104-busy1.png
(114.27 KiB) Downloaded 450 times
Last edited by vovchik on Thu 25 May 2017, 08:22, edited 1 time in total.

User avatar
souleau
Posts: 148
Joined: Sun 23 Oct 2016, 15:24

#63 Post by souleau »

Hey Vovchik, I just tried your logo generator and it is awesome.

Remember the svg wallpaper maker trio created a while back?! I tried that one at the time, and because I use the dutch locale, I ran into the same issue MochiMoppel ran into with your application.
In that thread, SFR supplied a solution to that problem.

http://murga-linux.com/puppy/viewtopic. ... 4&start=95

Perhaps this could be applied here.

I run Puppy Precise 5.7.1 myself, and, like I said, my locale is dutch, but surprisingly, the PNG's turn out perfect. The lettering of the SVG's it generates on my setup are not properly centered, or rather, the center is not properly defined, so they run off the image.

You know, maybe its time to post your creation in the software section of the forum, so that more people can discover your wondeful creation.
Attachments
root_20170524_18h51m36s_eurostile_bq-56-glass.png
(36.19 KiB) Downloaded 422 times

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#64 Post by vovchik »

Dear souleau,

Thanks. I am still adding features and testing, but I think I will eventually move it to the software section. I haven't posted this mod yet, but I have included a few of those stamps (andalusia, oriental, etc.) in trio's collection as pattern fills for font and background and they are working nicely. I am amazed at what adjustments to filters/fonts/grads/patterns can do do make stunning effects in 10 seconds or less. It would be nice also to be able to skew the x and y axes and to position text along a path. I am thinking. :)

As for your "comma" problem, musher0 pointed that out. I included a LANG setting in the code, but it doesn't seem to be working as expected. Musher0 suggested an easy fix - a little (one line) bash script:

Code: Select all

LANG=en_CA.utf8;txt2svg 
as a launcher, to prevent malfunctions due to locale. What do you think?

With kind regards,
vovchik

PS. Your turblulence SVG is now in the background colors/patterns as Nature1, and as a font fill as Busy1 and Busy2 (filters combo box).
PPS. Will now update source and binary with new filters/patterns and a launch script that sets the locale.
Attachments
vovchik_20170525_00h49m23s_droid_sans-197-solidify.png
(124.57 KiB) Downloaded 387 times
vovchik_20170524_23h06m11s_droid_sans-211-lumi.png
(171.11 KiB) Downloaded 389 times
vovchik_20170524_23h03m24s_droid_sans-211-busy1.png
(170.72 KiB) Downloaded 391 times

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#65 Post by SFR »

Hey Vovchik

Regarding the 'comma' problem - this is quite crude approach, but seems to work just fine:

Code: Select all

		FOR j = 2 TO text_lines + 1
			mysvg_b$ = mysvg_b$ & \
				"    <text x='" & align_no$ & "%' dy='" & REPLACE$(STR$(j + ((j-1) * .122)), ",", ".") & "em'>" & \
				TOKEN$(IMAGE_TXT$, j, NL$) & "</text>" & NL$
		NEXT j
I think 'opacity' also needs this treatment (from Musher0's SVG):

Code: Select all

text-anchor='middle' opacity='0,64' dominant-baseline='central'
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
souleau
Posts: 148
Joined: Sun 23 Oct 2016, 15:24

#66 Post by souleau »

My apologies to you Vovchik. I had changed the default svg viewer in my setup to inkview, which is a command-line svg viewing utility that comes with Inkscape, and it kept displaying the generated SVG's with the text displaced.

The problem seems to lie with the inkview utility, because the Gimp, Firefox and ViewNoir have no problem displaying the SVG's with proper text alignment.

You're right! SVG's are incredibly versatile and flexible. I still can't get over the fact that a couple of lines of XML code can generate such impressive graphics.

You can even create animations with it.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#67 Post by vovchik »

Dear souleau and SFR,

Thanks to both of you for testing, suggestions and code. I have asked Peter van Eerten, author of BaCon, how to set the locale decimal separator from within BaCon and hope to hear something soon. At the top of my code I have:

Code: Select all

SETENVIRON "LC_NUMERIC", "C"
but that doesn't seem to do the trick. There may be another way of doing that without resorting to the REPLACE$ method, but I don't yet know. Would be nice. :) I will post another mod soon, since I have added more patterns. One of these days I will have to tell myself to stop adding bells and whistles, although most of the effects are attractive and useful so I am still at it.

With kind regards,
vovchik

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#68 Post by SFR »

@Vovchik: I found a real fix. It's enough to place SETENVIRON "LC_NUMERIC", "C" before this:

Code: Select all

SETENVIRON "LC_NUMERIC", "C"

INCLUDE "../hug.bac", WINDOW, BUTTON, HSLIDER, COMBO, EDIT, SPIN, \
	HSEPARATOR, VSEPARATOR, IMAGE, TEXT, GRAB$, GET, SETPROPERTY, \
	FONT, SYNC, TOGGLE, ATTACH, DISPLAY, SCREENSIZE, HUGLIB$, CHECK, \
	HUGOPTIONS, MARK, ENTRY, SHOW, HIDE, CALLBACK, INIT, SET, QUIT, \
	ENABLE, DISABLE, LIST
INIT
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#69 Post by vovchik »

Dear SFR,

Brilliant! And thanks a million for nailing this. It took no actual new coding, but simply shifting what was already there up the ladder! I have done that now in my source. :)

With kind regards,
vovchik

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#70 Post by vovchik »

@ all: Updating source and 32-bit Tahr binary now. More patterns and better fills. Also no need for script launcher as SFR has solved the problem and it is now in the code. Thanks!
Attachments
vovchik_20170525_21h22m26s_droid_sans-245-inset-dark.png
(89.27 KiB) Downloaded 273 times
vovchik_20170525_16h39m14s_droid_sans-136-lumi.png
(126.35 KiB) Downloaded 274 times
vovchik_20170525_20h46m56s_droid_sans-146-outline-black.png
(60.64 KiB) Downloaded 277 times

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#71 Post by vovchik »

@ all: Added all sorts of interesting pattern fills.:) The modded source and a 32-bit Tahr binary are in the first post.
Attachments
vovchik_20170527_11h08m38s_droid_sans-155-metal.png
(59.32 KiB) Downloaded 236 times
vovchik_20170527_12h08m17s_droid_sans-138-metal.png
(64.15 KiB) Downloaded 239 times
vovchik_20170527_12h54m05s_droid_sans-184-inset-plain.png
(67.5 KiB) Downloaded 239 times

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#72 Post by step »

Very nice! Just a micro bug: the size slider resets to zero scale if the text input box is empty. In other words you can only generate a minimum-size boilerplate text.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#73 Post by vovchik »

Dear step,

Thanks. I wonder what I should do there. To fit the sample text, I set it to 24 in the event that the text box is empty. Should I, after the display, set it back to the 56, which is the starting default? I have an update ready to post with lots of code having been golfed (rendered more efficient/concise and additional patterns added), but I will wait so I can take care of this slider issue in the same update.

With kind regards,
vovchik

PS. If you just want a blank rectangle with some gradient and border, just hit enter a few times in the text box and set the box size manually or use the slider for a larger text size.

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#74 Post by step »

vovchik wrote:To fit the sample text, I set it to 24 in the event that the text box is empty. Should I, after the display, set it back to the 56, which is the starting default?
I think so. What if it doesn't fit? Leave it to the user to re-fit with a smaller font size. It's the same kind of situation that arises from specifying an offset near the bbox borders, the text doesn't fit and it's clipped.
PS. If you just want a blank rectangle with some gradient and border...
Cool trick!

When you post your examples PNGs, could you please also post their settings template in the description field? So we can re-create/adapt them more easily.
Thanks
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#75 Post by vovchik »

@ step: New version now resets font size zlider to 56 after generating the sample text, and CR and space not generate a blank rectangle - you can easily size using the sizing manual override or using the font size slider.

@ all: Updated binary and source - lots of "code golfing" and additional patterns.

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#76 Post by step »

Hi vovchik, there was some sort of misunderstanding, I didn't explain myself well enough.

The small issue I reported, which your code update didn't address, is that it isn't possible to generate boiler-plate text at any point size but 24. Example. Leave the text input box empty. Slide the size slider to any value you want. Press Apply. It renders 24-point boiler-plate text, no matter which size you request.

Also: You wrote, "New version now resets font size slider to 56 after generating the sample text", but I don't see that happening. More importantly, I don't want that. I know, now I'm contradicting myself from my previous post; but that's part of our misunderstanding. In my previous post I thought we were talking about boiler-plate text only, not about all text in general. Anyway, since the latest version doesn't reset the slider back to 56, all is well. Keep it that way. The version I tested is:

Code: Select all

# ls -l
total 96
drwxr-xr-x 2 ftp ftp  4096 May  3 22:51 icon
drwxr-xr-x 2 ftp ftp  4096 May  5 10:02 src
-rwxr-xr-x 1 ftp ftp 84752 May 31 00:08 txt2svg
-rwxr-xr-x 1 ftp ftp    39 May 25 00:54 Txt2Svg
One more thing, is Txt2Svg still needed? I thought you implied that SFR's language fix makes the launcher unnecessary.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#77 Post by vovchik »

Dear step,

The slider does reset to 56 after showing sample text in my latest mod (31 May - right after midnight). The reason I show the sample text at 24px is that it will go off the screen at larger font sizes. And the reason it exists in the first place is (i) so as not to generate a bad SVG when you press Apply and the box is empty and (ii) to give the user some indication about the glyphs that are contained in the font (diacriticals, cyrillic, oriental, UTF-8 symbols etc.). I myself was irritated at the font slider staying at 24px after a sample text, so my misunderstanding your request led to what I think is a good and useful mod. :)

As for the launcher script, I only have my locale - Australia (although I'm in Europe), so I cannot really test whether SFR's mod is doing its job. I assume it is but would like feedback from somebody using a locale where then decimal separator is, for example, a comma.

With kind regards,
vovchik
Last edited by vovchik on Wed 31 May 2017, 10:07, edited 1 time in total.

User avatar
souleau
Posts: 148
Joined: Sun 23 Oct 2016, 15:24

#78 Post by souleau »

vovchik wrote:As for the launcher script, I only have my locale - Australia (although I'm in Europe), so I cannot really test whether SFR's mod is doing its job. I assume it is but would like feedback from somebody using a locale where then decimal separator is, for example, a comma.
I have a european locale and I am happy to report that it works without a hitch for me.
Attachments
root_20170531_11h25m16s_urw_chancery_l-56-metal.png
(63.14 KiB) Downloaded 311 times

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#79 Post by vovchik »

Dear souleau,

Thanks for the report. I think I can safely remove the launcher script now. :)

With kind regards,
vovchik

PS. And I see you know how to use the little app. :)

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#80 Post by step »

I see what you're saying, the slider resets to 56 but only if the text input box is empty. If the input box contains some text the slider keeps the selected size after showing the rendition. It's good, thanks.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

Post Reply