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 Wed 22 Nov 2017, 11:01
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 2 of 8 [106 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7, 8 Next
Author Message
musher0


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

PostPosted: Fri 05 May 2017, 20:44    Post subject:  

HI vovchik.

Ok, your offset trick works, but:
-- this example was done using the DejaVu font.
Is that font badly crafted too?

Because I find it a bit too easy to blame the shortcomings of one's app on
the font designer. The font designers at Arkandis Digital Foundry have a
very good reputation. A programmer of your level shouldn't do that.

It may be that I have ticked or not ticked some essential configuration
item because of inexperience. That is entirely possible.

But to say off the bat that a certain font or group of fonts is bad? Then
please provide as much evidence as you can that that font is indeed bad,
according to font standards, not merely out of your opinion.

-- your app still does not place the text in the right order.
Did I forget to tick something in the config panel?

TIA for any pointers.
SwitzeraADF-is-OK.jpg
 Description   
 Filesize   110.05 KB
 Viewed   219 Time(s)

SwitzeraADF-is-OK.jpg

Hum(2)...jpg
 Description   
 Filesize   102.82 KB
 Viewed   224 Time(s)

Hum(2)...jpg


_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Sat 06 May 2017, 03:50    Post subject:  

Hi vovchik, thank you for the update. My font box looks much cleaner now Laughing

No further issues so far, but one question:
Many of my fonts don't support the setting of font weight. For logos etc. it would be nice to be able to make the fonts a bit fatter.
I looked into the generated svg code and found the line
Code:
<g stroke-width='0' stroke='black'

I appears that this stroke is a king of outline and by giving it a value the font gains weight. For the screenshot I've changed the color to red so that the difference becomes apparent. Leaving it black would result in a nice, bold font. Can these 2 parameters be set from the GUI? Obviously they are in the generated code, but I can't find them in the GUI.
fake_font_weight.jpg
 Description   
 Filesize   69.44 KB
 Viewed   230 Time(s)

fake_font_weight.jpg

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


Joined: 23 Oct 2006
Posts: 1441
Location: Ukraine

PostPosted: Sat 06 May 2017, 04:12    Post subject:  

Dear musher0,

I didn't mean to trash a particular font designer, but I have examined, say, a hundred or so TTFs character by character when making/designing a TTF vector display for open gl canvas (drawing individual glyphs after extracting and analysing the internal vector tables). I converted heaps of fonts glyph-by-glyph and put those into into c header files. In those files I can then see the bounding box info provided for each glyph, plus kerning info, baselines, descenders etc., and have noted that many font designers have gone off a bit on their own. And I wasn't absolutely categorical in that I did say in my commment "most probably". I have attached one of my own test progs that "embeds" a standard ttf (unisans), takes it apart, grabs all the vector and other info and displays the resulting Beziers (Tahr 32-bit, needs openGL).

But your particular problem is vexing, since I simply take the contents of a standard gtk edit box, wrap it in svg syntax and display. Why it is inverting the order of lines on your machine is a mystery, since this hasn't happened to me and I do not see how it can happen programatically, given the very simple code I use in grabbing the text and processing it. Can you post the resulting svg so that I can have a look? And has anybody else experienced this, too? Please report if you have had this problem!

With kind regards,
vovchik
ttf-vertex-bezier-svg-unisans_s1.tar.gz
Description 
gz

 Download 
Filename  ttf-vertex-bezier-svg-unisans_s1.tar.gz 
Filesize  60.57 KB 
Downloaded  42 Time(s) 
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1441
Location: Ukraine

PostPosted: Sat 06 May 2017, 04:38    Post subject:  

Dear MochiMoppel,

Thanks for testing. I am glad that you did not experience musher0's problems (I hope). You are right about the usefulness of having a stroke-width spinbox. Since I am basically lazy (Smile), I don't want to redesign the entire gui yet (but I will probably have to once I include skewX/Y and matrix), I could fit a little spinbox after the "Font style" combo box. Would that be OK?

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


Joined: 23 Oct 2016
Posts: 112

PostPosted: Sat 06 May 2017, 05:13    Post subject:  

Great work vovchik!

I wonder, is there perhaps a chance some time in the future to add a filter function to the backround as well? It would make backrounds like these a possiblity:

Code:
<svg xmlns="http://www.w3.org/2000/svg" width="640" height="480">
<defs>
   <filter id="myFilter01" x="0" y="0" width="100%" height="100%">
   <feTurbulence baseFrequency=".005" numOctaves="1" seed="6" type="turbulence"/>
   <feComponentTransfer>
   <feFuncA type="table" tableValues="1 0"/>
   </feComponentTransfer>
   </filter>
   <filter id="myFilter02" x="0" y="0" width="100%" height="100%">
   <feColorMatrix type="hueRotate" values="180" result="A" />
   </filter>
</defs>
<g filter="url(#myFilter02)" >
<g filter="url(#myFilter01)" >
<rect width="640" height="480" />
</g>
</g>
</svg>


I know it's a tall order. I was actually surprised you went anywhere near the filter functions in the first place.
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Sat 06 May 2017, 07:00    Post subject:  

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.
Quote:
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.
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1441
Location: Ukraine

PostPosted: Sat 06 May 2017, 07:47    Post subject:  

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.
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1441
Location: Ukraine

PostPosted: Sat 06 May 2017, 08:04    Post subject:  

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. Smile

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


Joined: 26 Jan 2011
Posts: 1392
Location: Japan

PostPosted: Sat 06 May 2017, 08:58    Post subject:  

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.
svg_font_stroke.png
 Description   font size 200. Stroke 0 vs. stroke 10
 Filesize   57.8 KB
 Viewed   182 Time(s)

svg_font_stroke.png

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


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

PostPosted: Sat 06 May 2017, 09:06    Post subject:  

@vovchik,

Please find attached requested svg.

BFN.
root_20170505_17h07m49s_switzera_adf-56-none.svg.zip
Description 
zip

 Download 
Filename  root_20170505_17h07m49s_switzera_adf-56-none.svg.zip 
Filesize  739 Bytes 
Downloaded  40 Time(s) 

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1441
Location: Ukraine

PostPosted: Sat 06 May 2017, 09:25    Post subject:  

@musher0

SmileSmileSmile 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:
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. Smile

@ 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
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1441
Location: Ukraine

PostPosted: Sat 06 May 2017, 10:02    Post subject:  

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
Back to top
View user's profile Send private message 
musher0


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

PostPosted: Sat 06 May 2017, 11:23    Post subject:  

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:
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.
The-Ottawa-River-is-in-flood.jpg
Description 
jpg

 Download 
Filename  The-Ottawa-River-is-in-flood.jpg 
Filesize  210.88 KB 
Downloaded  44 Time(s) 

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1441
Location: Ukraine

PostPosted: Sat 06 May 2017, 12:19    Post subject:  

@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,. Smile Source and Tahr binary will be updated in a few minutes.
vovchik_20170506_18h05m30s_times_new_roman-156-relief.png
 Description   
 Filesize   239.53 KB
 Viewed   117 Time(s)

vovchik_20170506_18h05m30s_times_new_roman-156-relief.png

txt2png5.png
 Description   
 Filesize   107.64 KB
 Viewed   115 Time(s)

txt2png5.png

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


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

PostPosted: Sat 06 May 2017, 16:58    Post subject:  

Patterns? Yuk! Laughing (This is irony, my friends, irony!!!)
_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 8 [106 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 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.0780s ][ Queries: 14 (0.0167s) ][ GZIP on ]