xsl fo - How can I make text automatically scale down in an SVG? -


I have a SVG element that I have created with inscaps. I then take SVG and parts of the XSL-FO stylesheet Which is used for changing XML data and then passed through the IBX renderer to create a PDF (which is usually printed). As an example, I have elements in SVG / stylesheet that are due to Inkscape Expert (additional noise) like this:

   & Lt; / Tspan & gt; & Lt; / Text & gt;   

My problem lies in the fact that I do not know how big this text area will be. In this particular case, I have an image on the right side of the SVG text, however, if this is the maximum permitted number of string W, then this is a very long way and the image goes on. What I want (in a whole world) tells me how many pixels wide I want to be a text block and then it will automatically reduce the text until it fits in that area. If I can not do that, then reducing the text will also work as a support for the last ditch, I am going to use a fixed width font and I can slice the string in the XP generation, Be able to become less and less beautiful.

I have poked around in SVG documentation and saw a little more along the paths in the flowRegions but I do not think enough what they want (maybe they are though) Are there. If it helps, then it is a style string that generates Inkscape:

  "font-size: 20px; font-style: normal; font-variation: normal; font-weight: Normal; Font-Stretch: Normal; According to the text: Start; line-height: 125%; Letter-spacing: 0px; Word-spacing: 0px; Writing mode: LR TB; Text anchor: Start; Fill: # 000000 Filling-opacity: 1; stroke: none; font-family: without; -con-font-specification: without "  

Thanks for the help.

You have an arbitrary text of the length of the line (in the context of letters) Want to scale to fit inside the place? The only way I can think of saving the text to a certain size is to put it inside a svg element and then scale the SVG to that size:

  & lt; ? Xml version = "1.0" encoding = "UTF-8" standalone = "no"? & Gt; & Lt; Svg width = "100%" height = "100%" version = "1.1" xmlns = "http://www.w3.org/2000/svg" xmlns: xlink = "http: //www.w3.org / 1999 / XLink "& gt; & Lt; Title & gt; Resizing Text & lt; / Title & gt; & Lt; Defs & gt; & Lt; Svg id = "text-1" view box = "0 0 350 20" & gt; & Lt; Text id = "text-2" x = "0" y = "0" fill = "# 000" alignment-baseline = "first-side" & gt; This is the end of the world as we know, and I feel fine! & Lt; / Text & gt; & Lt; / Svg & gt; & Lt; / Defs & gt; & Lt; Rect x = "500" y = "100" width = "200" height = "40" fill = "# eee" /> & Lt; X = "510" y = "110" width = "180" height = "20" xlink: href = "# text-1" /> & Lt; / Svg & gt;   

However, as seen above, the encapsulating svg element should be set to the width of the text on the view box Which you probably do not know.

If you are referring to this SVG with a scripting available (for example a web browser) in a user agent, then you can easily write a script to capture the width of Set the text and view box accordingly.

Comments