Text Border?

Post questions on how to use or achieve an effect in Inkscape.
bbbb

Text Border?

Postby bbbb » Thu Jan 07, 2010 1:30 am

hi,
I'd like to create an image in inkscape, where i have text, with a border around it, just like in this picture:

Image

how can i do this in inkscape?

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Text Border?

Postby brynn » Thu Jan 07, 2010 1:57 am

Select the Text tool.
Type.
Fill and Stroke dialog
Choose Fill color.
Choose Stroke color.

For excellent instruction on everything from the basics to intermediate or advanced level info, please see the Help menu > Inkscape Manual (need internet connection).

Also in the Help menu are Tutorials. If I recall, there are 5 or 6 of them, all teaching the basics of Inkscape.

User avatar
c-quel
Posts: 68
Joined: Thu Dec 31, 2009 2:13 am
Contact:

Re: Text Border?

Postby c-quel » Thu Jan 07, 2010 2:20 am

Hello bbbb [what a convenient name] ;)

Actually, in your case you actually have a DOUBLE border -- a green and grey border encircling the letter "A".
There are a few ways to go about reproducing this effect, but I'll describe the fastest....

Indeed as Brynn said, the blue "A" and grey border can be achieved by the usual steps....

Select the Text tool.
Type "A".
Open the Fill and Stroke dialog
Choose the Fill color (blue).
Choose the Stroke color (grey).


In the Stroke Style tab of the Fill and Stroke dialog, you can play around with the Join and Cap settings to fix the stroke edges to suit your taste.

Once this part is done,....

Duplicate the letter "A" (CTRL+D).
Make the Fill color transparent.
Make the Stroke color (green).
Move this second "A" below the first [use PageDown or End keys]
Expand the Stroke width so that the green stroke encircles the grey one properly.


If the grey stroke has a Stroke width of 1px, then the green one will likely have a width of 3 or 4px, just to give you an idea. ;)

Please note that if you ever reedit the text, you have to do it twice (for the top (blue+grey) and bottom (green) text. Unless you want to use Cloning, but then not sure if you want to get THAT deep into this. [This is already a huge post, lol] :P

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Text Border?

Postby brynn » Thu Jan 07, 2010 3:29 am

Ohhhh :oops: my bad!
Because of poor vision, I did not notice that there's a transparent strip between the blue and green. Please disregard my instructions and do what c-quel suggests.

....Although, c-quel, is that a gray border, between the blue and green, that's the same or nearly the same color as the background color of the message area, or is it simply transparent?

User avatar
c-quel
Posts: 68
Joined: Thu Dec 31, 2009 2:13 am
Contact:

Re: Text Border?

Postby c-quel » Thu Jan 07, 2010 4:08 am

haha! I'm pretty sleep-deprived at the moment, so can't tell the difference either, lol. :)

I'm hoping it's grey, since a transparent gap brings with it some additional hoopla that I just don't have the energy to describe at the moment. ^^'

Although traditionally, I usually do something like....

Type Text #1
Prepare Fill and Stroke on Text #1
CTRL+D to make Text #2
Make Stroke Width on Text #2 really really big
Do Stroke-to-Path on Text #2
Make its Fill transparent and Stroke the desired color (green)
Send to back
Have cup of tea to stay awake


...but only for immutable lettering that I don't intend to reedit often. :roll:

...

*passes out*

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Text Border?

Postby brynn » Thu Jan 07, 2010 5:12 am

...but only for immutable lettering that I don't intend to reedit often

I think you might be able to do it, so that it remains editable. Although basically I'm thinking it wuold involve 2 text objects on top of each other. If your whole image consists of the single big letter, it should work easily. But if you're gonna have a string of text, it would be really tricky to align the text object properly. So just a thought :?

User avatar
c-quel
Posts: 68
Joined: Thu Dec 31, 2009 2:13 am
Contact:

Re: Text Border?

Postby c-quel » Thu Jan 07, 2010 5:44 am

As long as the bottom text is bigger (in terms of girth) than the top one, then yeah that could work and we could have both sets editable. :)

Problem is that when text tends to get bigger (either due to size or font), it also tends to get longer as well, and might not align properly with the original lettering (or it may for the first few words, but not subsequent ones). Depending on the task at hand, it might take a while to wrestle with chunky text, lol. :P

However, I'm wondering now if there might be an Extension that could create this kind of double border. It doesn't sound like it'd be hard to automate, and it is a sought-after text effect. :geek:

Sadly, I rarely play around with Extensions, that should go on my TODO list some day. :lol:

Jaws
Posts: 41
Joined: Mon Nov 12, 2007 6:12 am
Contact:

Re: Text Border?

Postby Jaws » Thu Jan 07, 2010 11:23 am

You could simply duplicate the letter, remove the fill, add a stroke, and use Dynamic Offset or Outset on the stroke.

Cheers

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Text Border?

Postby brynn » Thu Jan 07, 2010 3:23 pm

Problem is that when text tends to get bigger (either due to size or font), it also tends to get longer as well, and might not align properly with the original lettering (or it may for the first few words, but not subsequent ones). Depending on the task at hand, it might take a while to wrestle with chunky text, lol.

Yeah, that's what I meant by "tricky". Truly this idea would really only work for a single letter.

Offset IS a way to go, and truthfully, there are probably several ways to achieve what bbbb wants. The problem I would have with Offset, Outset or Inset, is the distortion. You would see slightly rounded corners in the offset, for example.

User avatar
kelan
Posts: 178
Joined: Thu Sep 06, 2007 12:55 am
Location: Unicorn of Open Source
Contact:

Re: Text Border?

Postby kelan » Fri Jan 08, 2010 12:29 am

Unfortunately, offsets tend to look wrong on text because the corners get smoothed. Sometimes that's what you want, of course, but from the image in the original post, I'm guessing not in this case. The correct way to do it and keep the text editable is using clones. Due the styling behavior with clones, though, it gets a bit complicated, which is what c-quel was referring to earlier.

We're actually going to need one text object and four clones: one clone for the text fill, and three to make up the offset stroke.

  1. Type your original text. Set both its fill and stroke to Unset. This is necessary to be able to style the clones.
  2. Clone the text (Alt+d) to make the fill clone (C-fill). Move C-fill away, we don't need it until the end.
  3. Clone the text to make the offset stroke clone (C-stroke). Move it away, so we can work with it without the original getting in the way. At this point, you can move the original completely out of the way because we don't need to work with it any more.
  4. Now figure out the offset stroke dimensions you want: how thick you want the transparent area, and how thick you want the visible offset stroke. For this example, let's say the transparent area will be 2px wide, and the offset stroke will be 3px wide.
  5. Set C-stroke's stroke to the final outline color you want, and 10px wide (double the sum of the final width and the transparent area).
  6. Duplicate C-stroke (Ctrl+d) to make the opaque mask clone (C-omask). Set C-omask's fill and stroke to white, and its stroke to be 10px wide (double the sum of the final width and the transparent area).
  7. Duplicate C-omask (Ctrl+d) to make the transparent mask clone (C-tmask). Set C-tmask's fill and stroke to be black, and its stroke to be 4px wide (double the width of the transparent area).
  8. At this point it should look like your text with a thick white outline and black fill. The white areas will show through on the final outline, the black areas will become transparent. That's how masks work. We had to double all the stroke widths because a stroke's width is centered on the edge of the object, meaning half the stroke is on the inside of the object and half is on the outside, and only the outside part of the stroke matters to us here.
  9. Group C-omask and C-tmask. You can do so by first selecting C-tmask, which should be on top, then holding Shift and Alt and click it again. That will select the object beneath C-tmask, which should be C-omask. Then group them with Ctrl+g.
  10. Hold Shift and Alt again and click the new group, and it should select C-stroke, which is sitting beneath that group. Set the mask by going to the Object menu, Mask -> Set.
  11. Now you should see just a thin outline of your text with a most of the inner area transparent.
  12. Find C-fill and align it with the outline using the Align and Distribute dialog (Shift+Ctrl+a).

At this point you can change the stroke color by selecting the stroke object and changing its stroke color, or change the fill color by selecting the fill object and changing its fill color. You might want to group the two objects so they stay aligned if you move them. If you need to change the offset stroke's width, you'll need to unset the outline object's mask, change the widths of C-omask and C-tmask, and then set the mask again.

The last thing to deal with is the original text object, which is still hanging around. That needs to be kept, but you can make it invisible by either moving it outside the bounds of the document page (where normal renderers won't go), placing it on an invisible layer, or putting it in its own group (select it and press Ctrl+g) and setting the group's opacity to 0. If you chose one of the last two options and need to change the text, go to outline mode to find it (View menu, Display mode -> Outline).

It seems complicated, but once you understand clones and masks it's pretty straightforward. Although, honestly, this is something Inkscape could handle automatically with some UI enhancements.

User avatar
RobA
Posts: 335
Joined: Fri Aug 10, 2007 1:22 am

Re: Text Border?

Postby RobA » Fri Jan 08, 2010 3:51 am

kelan wrote:Unfortunately, offsets tend to look wrong on text because the corners get smoothed. Sometimes that's what you want, of course, but from the image in the original post, I'm guessing not in this case. The correct way to do it and keep the text editable is using clones. Due the styling behavior with clones, though, it gets a bit complicated, which is what c-quel was referring to earlier.


That is what I was trying to do, but missed the grouping to get the mask, and wasn't successful :(

Here is the results compared:
outline_test.png
outline_test.png (54.7 KiB) Viewed 19634 times


and the svg file is attached in case anyone wants to play with it.

The only deviation was to move the clone source to a new layer with it's visibility turned off. To access it, click on the coloured clone and shift-D then edit the text.

Interestingly, the clones are much faster at updating changes than the linked offsets (as the offset is calculating all the curves, etc.)

-Rob A>
Attachments
outline_test.svg
(30.33 KiB) Downloaded 324 times

bbbb

Re: Text Border?

Postby bbbb » Fri Jan 15, 2010 2:30 am

the last one is great, with the linked offset. Now how do i change the color of the border to white?

or - to show you what exactly i want to create: http://img697.imageshack.us/img697/8072/tarantino1024x768.jpg

I want to make a SVG File i can use for creating something like an exact copy of the T-Shirt.
The Font used for the upper text is "Squealer" and it's a free font you can download here.

User avatar
c-quel
Posts: 68
Joined: Thu Dec 31, 2009 2:13 am
Contact:

Re: Text Border?

Postby c-quel » Fri Jan 15, 2010 3:48 am

lol! You should've posted that to begin with. :lol:
I mean if all you need to do is recreate that image to the letter (including black background), then the method I described first will help you whip that up in less than a minute. You don't even have to bother making a gap between the fill and stroke, since its all black anyway. :P

bbbb

Re: Text Border?

Postby bbbb » Sat Jan 16, 2010 1:49 am

c-quel wrote:lol! You should've posted that to begin with. :lol:
I mean if all you need to do is recreate that image to the letter (including black background), then the method I described first will help you whip that up in less than a minute. You don't even have to bother making a gap between the fill and stroke, since its all black anyway. :P

it's all black but i still need a gap because if i'm going to print the svg on a shirt the black "gap" would be printed in black on the black shirt... :?:

kxra
Posts: 1
Joined: Mon Jun 03, 2013 11:35 am

Re: Text Border?

Postby kxra » Mon Jun 03, 2013 11:38 am

This seems very cumbersome. I wonder if it would be possible to implement a "position" option for borders (maybe padding while we're at it!) like this rough mockup i just made: http://i.imgur.com/QT7TazG.png

Edit: I just got a great response on IRC about that question

su_v | kxra: not with SVG 1.1 (this is not an Inkscape limitation, but one in SVG 1.1)
su_v | http://www.w3.org/Graphics/SVG/WG/wiki/ ... e_position
kxra | su_v: ah, and inkskape hasn't even finished full support for 1.1, has it?
su_v | paint order in SVG 2.0 will also help (especially when outlining text):
| http://tavmjong.free.fr/blog/?p=646
kxra | so 2 is a ways away


Return to “Help with using Inkscape”