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
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#21 Post by MochiMoppel »

vovchik wrote:I am glad that you did not experience musher0's problems
I didn't even experience his 2nd problem (?). Here with Autoscaling enabled and Offset y=86 the text shifts down, his text stays centered.
I could fit a little spinbox after the "Font style" combo box. Would that be OK?
Up to you, I don't think it's urgent.

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

#22 Post by vovchik »

Dear MochiMoppel,

Thanks for your testing and suggestions. I have already implemented the stroke-width spinbox and it is VERY USEFUL. And it's good that you did not have musher0's problems. I cannot understand how the string sequence gets inverted by newline, since I go line by line in assembling the SVG. I wonder whether he has some BIDI setting active.

Let me know how the stroke-width spinbox is working with your fonts.

With kind regards,
vovchik

PS. Will post the new version (binary and source) in a few minutes.

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

#23 Post by vovchik »

Dear souleau,

Thanks - it is a nice idea. I will have to have a think about how to implement filters for backgrounds. It shouldn't be too daunting a task, I think. :)

With kind regards,
vovchik

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#24 Post by MochiMoppel »

vovchik wrote:Let me know how the stroke-width spinbox is working with your fonts.
Works perfectly (see screenshot)

I'm still puzzled by the autoscaling behavior. Something is not right here.
Manual scaling 148x172 Offset y=89: looks OK
Autoscaling changes values in code to
148x83 Offset y=89: This can't work. Produces empty box. Impossible to show anything in a 83px tall box with a 89px vertical offset.
Attachments
svg_font_stroke.png
font size 200. Stroke 0 vs. stroke 10
(57.8 KiB) Downloaded 207 times

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#25 Post by musher0 »

@vovchik,

Please find attached requested svg.

BFN.
Attachments
root_20170505_17h07m49s_switzera_adf-56-none.svg.zip
(739 Bytes) Downloaded 108 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

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

#26 Post by vovchik »

@musher0

:):):) I understand what is happening. You have French for your numbers, so the amout of y-axis displacement (in decimal ems) is nonsense in an SVG. SVGs want decimals with a dot ("."), and not commas, and your SVG, running with localization, is created with the value "2,122em" and not "2.122em". I will have to think of how to fix that in the program, but will have to ponder consequences, since decimal numerics in SVGs have to be with the dot and not a comma, as I understand (although there might be an override needed in the header info about charset). In the meantime, you can run the prog from the command line or in a script as follows :

Code: Select all

export LC_NUMERIC=en_AU.UTF-8 ./txt2svg
Thanks for posting the SVG. It told me everything I wanted to know to understand the problem. All we need now is an evegant and simple solution. :)

@ MochiMoppel

The autoscaling is done by pango, given a particular font and size. It returns the size of the bounding box in two variables. I multiply the width and height by factors to give room for some shadow effects, which pango cannot know about. The offsets are not affected or reset by autoscaling, so you have to null them after doing manual dimensioning and then autoscaling. I will think about whether it is useful to set x and y offsets to zero following an autscaling operation.

With kind regards,
vovchik

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

#27 Post by vovchik »

Dear musher0,

Can you try the latest binary, just uploaded? I added LC_NUMERIC=C (posix) to the code in an attempt to override user locale decimal settings in the hope that the SVGs generated are with period decimal separators. That was the problem with your generated SVG. The last text entry in the SVG had a comma, rather than a period, as the decimal separator for the vertical displacement.

With kind regards,
vovchik

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#28 Post by musher0 »

Hello vovchik.

Thanks for your kind reply.

I tried your new version, but the problem remains the same. However,
following your hunch about LANG above, if I launch your progam like this:

Code: Select all

LANG=en_CA.utf8;txt2svg 
instead of with my usual LANG=fr_CA.utf8, the results are as expected.

Illustration with console and app attached.

BFN.
Attachments
The-Ottawa-River-is-in-flood.jpg
(210.88 KiB) Downloaded 137 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

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

#29 Post by vovchik »

@musher0

I am glad you could solve the problem by changing the environment temporarily. I would stuill like a better soluion, so as not to give people headaches.

@all

We now have patterns,. :) Source and Tahr binary will be updated in a few minutes.
Attachments
vovchik_20170506_18h05m30s_times_new_roman-156-relief.png
(239.53 KiB) Downloaded 143 times
txt2png5.png
(107.64 KiB) Downloaded 139 times

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#30 Post by musher0 »

Patterns? Yuk! :lol: (This is irony, my friends, irony!!!)
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
OscarTalks
Posts: 2196
Joined: Mon 06 Feb 2012, 00:58
Location: London, England

#31 Post by OscarTalks »

Hello vovchik,

Your pre-compiled static binary does run in DpupWheezy but I wanted to test a build from source. The native bacon was too old so I compiled the latest (3.5.4) with no problems. I also grabbed the HUG file from the website as suggested. Source then compiles and runs fine. Thanks for your excellent work.
Oscar in England
Image

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

#32 Post by vovchik »

@ musher0 and all

Just added a "yucky" diagonal pattern (best viewed with the solidify and relief filters) and incorporated a very useful mod by alexfish at basic-converter.org that prevents exiting the app by inadvertently clicking on the close button on the taskbar.

@OscarTalks

Great that that your compilation went OK. After I compile, I usually strip and upx, operations that reduce the size of the resulting HUG-based binaries by some 75%, just to keep things small. :)

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#33 Post by fredx181 »

Hello vovchik,

Thanks for your beautiful program!

Tested on Debian(Dog) , first didn't run but found that a symlink libpangocairo-1.0.so > libpangocairo-1.0.so.0 is required to make it work.
So I thought changing line 59 in txt2svg.bac

Code: Select all

CONST pango$ = "libpangocairo-1.0.so"
To:

Code: Select all

CONST pango$ = "libpangocairo-1.0.so.0"
and recompile should do.
But when compiling I get:

Code: Select all

root@jessie:~/src# bacon -o -Os -o -fdata-sections -o -ffunction-sections -o -Wl,--gc-sections txt2svg.bac
Converting 'txt2svg.bac'... 1157
Syntax error: could not parse line 1157 in file 'txt2svg.bac'! 
Any idea what I'm possibly missing?
I should note that the error was also already when I tried before making the edit libpangocairo-1.0.so.0 in txt2svg.bac

Fred

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

#34 Post by vovchik »

Dear fredx181,

Thanks. And good that you acre trying to compile it yourself. I think you might be using an older version of bacon. Get the latest, and the latest HUG, from www.bacon-converter.org. The line that cause the stutter was:

Code: Select all

SAVE mysvg$ TO "/tmp/txt2svg.svg"
and that syntax (SAVE TO) appeared only recently. That is probaby the only reason for the error. As for libpangocairo, I have compiled on various systems, including Mint, Tahr and Raspbian Debian for Pi, and got no errors regarding the lib location. Weird.

With kind regards,
vovchik

PS. I am posting a new version soon with hatch, crosshatch and other pattern fills. :)
Attachments
pi_20170508_00h10m00s_trebuchet_ms-153-solidify.png
(79.99 KiB) Downloaded 361 times
Last edited by vovchik on Sun 07 May 2017, 22:12, edited 1 time in total.

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#35 Post by fredx181 »

vovchik wrote:I think you might be using an older version of bacon
Ah, yes, thanks vovchik, compiled fine now (also needed latest hug.bac, indeed)
As for libpangocairo, I have compiled on various systems, including Mint, Tahr and Raspbian Debian for Pi, and got no errors regarding the lib location. Weird.


For Debian-Jessie (don't know about other distros) I think the point is that the package libpango1.0-dev has the symlink libpangocairo-1.0.so, but the package libpangocairo1.0 doesn't (has only libpangocairo-1.0.so.0) see screenshot
So I'd like it to work (just to run txt2svg binary, not compiling) also without the dev package installed, which I did now, thanks again :)

Fred
Attachments
libpangocairo.png
libpangocairo-1.0.so.0 in libpangocairo1.0
(23.51 KiB) Downloaded 410 times

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

#36 Post by vovchik »

Dear fredx181,

I checked my systems and I do have libpangocairo-1.0.so.0 on all of them, so that might be a better choice for the libname (Rasbpian is some form of Jessie). I'll experiment and ask around. :) The reason I used what I did is that I wrote that that pango function that gets the bounding box for text a few years ago and never thought about it since. I will aslo ask Peter whether we shouldn't include that GET_SIZE function in HUG, in which case HUG's lib scanner will take care of finding a suitable lib. There is HUGLIB$("pango") in HUG already.

With kind regards,
vovchik

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

#37 Post by step »

Fatdog64-710, which is based on BLFS, does have /usr/lib64/libpangocairo-1.0.so.0
[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

#38 Post by vovchik »

@step: Thanks for reporting.
@all: Updated first post (8 May, evening) with new binary and source. Several new filters (glass, icy, metal, slick shadow, etc.) :)
Attachments
vovchik_20170508_23h23m05s_droid_sans-101-slick-shadow.png
(88.18 KiB) Downloaded 268 times
vovchik_20170508_17h41m35s_gooddog-107-metal.png
(77.52 KiB) Downloaded 298 times
vovchik_20170508_17h23m54s_retro_stereo_wide-87-icy.png
(177.99 KiB) Downloaded 301 times

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#39 Post by jamesbond »

Vovchik, excellent work!

Suggestion: ability to save/load the "settings" (or "design" if you want to). Use case: let's say I create this nice logo, save the SVG, and exit. A few hours later I look at the SVG and say, uh oh, I should split it into two lines ... but I no longer remember exactly the parameters used to create the original. If there is a handy way to save/load the "design" that would be nice.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#40 Post by MochiMoppel »

@vovchik: I've never missed font patterns but I miss an important font "color": transparent. I tried 'User color' from the combo box and 'none' in the entry fileld, but this does not work. It is an option in the background combo box and I think it should also be an option for the foreground. With a transparent font and a non-zero stroke-width you can build nice logos without having to fiddle too much with filters.

This is my previous example with fill='none' and stroke-width='10' and '7':
Attachments
textcolor_transparent_stroke_10_7.png
(106.31 KiB) Downloaded 278 times

Post Reply