An author, graphic designer, or other content creator may desire at times, e.g., for artistic and/or other visual effect, to have text follow a path other than a traditional linear path running (in English) from left to right along a line parallel to the bottom of the page. Software applications have provided limited ability to include text along a nonlinear path, but to date such capabilities have been limited to a constrained set of predetermined paths or path types and have not supported such common word processing functionality as arbitrary user specified styling, wrapping, etc. In addition, in some cases text has been laid out along a path in a manner resulting in undesirable effects, such as one or more adjacent glyphs interfering with (e.g., overlapping or being placed too near) each other. Therefore, there is a need for a more flexible and effective way to render text along a nonlinear path.
Various embodiments of the invention are disclosed in the following detailed description and the accompanying drawings.
The invention can be implemented in numerous ways, including as a process, an apparatus, a system, a composition of matter, a computer readable medium such as a computer readable storage medium or a computer network wherein program instructions are sent over optical or electronic communication links. In this specification, these implementations, or any other form that the invention may take, may be referred to as techniques. A component such as a processor or a memory described as being configured to perform a task includes both a general component that is temporarily configured to perform the task at a given time or a specific component that is manufactured to perform the task. In general, the order of the steps of disclosed processes may be altered within the scope of the invention.
A detailed description of one or more embodiments of the invention is provided below along with accompanying figures that illustrate the principles of the invention. The invention is described in connection with such embodiments, but the invention is not limited to any embodiment. The scope of the invention is limited only by the claims and the invention encompasses numerous alternatives, modifications and equivalents. Numerous specific details are set forth in the following description in order to provide a thorough understanding of the invention. These details are provided for the purpose of example and the invention may be practiced according to the claims without some or all of these specific details. For the purpose of clarity, technical material that is known in the technical fields related to the invention has not been described in detail so that the invention is not unnecessarily obscured.
Rendering text along a nonlinear path is disclosed. A nonlinear path is received. In various embodiments, the path may be any arbitrary path described in any number of ways, such as by specifying a locus of points, selecting a predefined path, providing an image, providing or selecting a shape, and describing as a polynomial or other equation, a path along which text is desired to flow. Text desired to flow along the path is received. The glyphs comprising the text are placed one by one along the path in a manner that in a manner that avoids interference between adjacent glyphs (e.g., no overlap) and unpleasing visual effects (excessive gaps, uneven spacing, etc.). In some embodiments, curve smoothing is applied to smooth a nonlinear path so as to facilitate placing text along the path. In some embodiments, at least some paths are approximated as a series of chords for purposes of placing text along a nonlinear path. In some embodiments, existing kerning information is used for text placement along at least some nonlinear paths. In some embodiments, additional information is defined for text characters (or other glyphs) to make it possible to take advantage of kerning opportunities not applicable to placing text along a linear path, e.g., by defining for at least some glyphs a non-rectangular quadrilateral or other polygon that conforms more nearly to the outline of the glyph, e.g., a first glyph, thereby permitting an adjacent (second) glyph having a complementary outline—at least when place adjacent to the first glyph along the particular nonlinear path along which text is desired to flow—to be placed nearer the first glyph than would otherwise be done using a rectangular glyph box for each glyph. Shapes can be described as a sequence of paths that are filled in their interior and/or stroked along their perimeter, where each path is described by specifying planar coordinates (x, y) as a function of a parameter t that varies continuously along the path and uniquely identifies points along the path, or by specifying a functional relationship between the x and y coordinates. As examples, x and y could each be polynomial functions of t, or x and y could be related by the condition that a multinomial in x and y is equal to zero. Bezier curves are a special case of the former, and conic sections (ellipses, hyperbolae, parabolas, straight lines) are special cases of the latter. Shapes can be filled and/or stroked with color, patterns, gradients, images, etc.
Providing text flow along an arbitrary non-linear path and with arbitrary styling is disclosed. In some embodiments, each character (glyph) is positioned along the non-linear path in a manner that ensures no character interferes with another character, regardless of the font, size, styling, or other attributes applied to the text. In some embodiments, the description of each glyph comprising a font is used to position the glyph in a manner that ensures the glyph is spaced by a prescribed and/or minimum amount from all other glyphs. For example, in the case of a vector graphic font, the vector graphic description of the outline of the glyph is used to ensure that the glyph does not intersect the corresponding outline of any other character. While precise, using the vector graphic description of each glyph to avoid overlap and/or ensure minimum and/or prescribed spacing may in some environments be too computationally expensive. Therefore, in some embodiments, selection box, anchor point, advance, kerning and other information that already exists for most fonts for purposes of linear text flow are used to providing text flow along a non-linear path. In some embodiments, each successive glyph is positioned along the nonlinear path such that the glyph box does not overlap and/or has a minimum and/or prescribed spacing from the nearest adjacent glyph box.
Kerning has long been used in linear text flow to enable certain glyphs having complementary shapes to be spaced more closely together than other glyph pairs.
Using kerning information to position text along a nonlinear path is disclosed. In some embodiments, kerning information included in and/or associated with font definition data for a particular pair of glyphs (or in some cases glyphs selected from complementarily shaped groups of glyphs), if applicable, is taken into consideration in determining whether adjacent glyph boxes overlap or overlap by an unacceptable amount. The radius of curvature of a path can be different at each point along the path, so in general it is a function of the path parameter t. The radius of curvature at a point is the radius of the circular arc that most closely approximates the path near that point, in the sense that it has the same value, first derivative and second derivative of the path functions x(t) and y(t) as a function of distance parameter t, when evaluated at that point. (If the path is not already parameterized by distance then it is simple to derive an equivalent path parameterized by distance). It can be shown that the radius of curvature of a path is equal to the reciprocal of the magnitude of the second derivative of the position vector as a function of distance parameter t. In some embodiments, font kerning information developed (primarily) for linear text flow is used when all the radius of curvature values k(t) throughout the portion of a path along which text is laid out are significantly greater than an intrinsic measure of font size or scale. In some embodiments, the intrinsic measure of font size or scale is one “em”, i.e., the declared point size of the font in question, which is historically the width of the capital letter ‘M’, in typefaces that include the letter ‘M’, or a roughly equivalent measure of width in typefaces that do not include a glyph for ‘M’ (e.g. those designed exclusively to represent Chinese, Arabic or symbolic characters).
Prior art approaches for providing text flow along a nonlinear path typically do not take advantage of additional kerning opportunities presented by the fact that adjacent glyphs may have complementary shapes that allow them to be positioned more closely together when positioned along a curved path than would be possible along a linear path. For at least some glyph pairs, such additional kerning opportunities are most significant when the radius of curvature is not much greater than the glyph size.
Of course, if the radius of curvature is too small relative to the glyph size, it may not be possible and/or desirable to arrange the text to flow along the precise received path because of readability problems, for example. Even if the glyphs are positioned such as to avoid each other, they may appear at very inconsistent angles and in such a way that the sequence of characters is not obvious, or it is not obvious where word breaks are supposed to occur. In some embodiments, if the minimum radius of curvature of a received path is smaller than a threshold multiple of an intrinsic measure of font size, such as a few “em”, then a new path that approximates the original but has a larger minimum radius of curvature is used for purposes of laying out text. The below Appendix, under the heading Smooth Path Generalization in 2D, discloses formulas for constructing a new path meeting these requirements. In the field of Geographic Information Systems, there are known techniques for approximating a sampling of survey points along a path with fewer points for purposes of efficient map rendering at lower resolutions, and this process is called generalization. However, the problem addressed in the below Appendix is different in the sense that the input is a smooth path, not a sampling of data points, and the goal is not limited to achieving a visual approximation; it is also a goal to reduce minimum radius of curvature. Similarly, the statistical technique called kernel smoothing is aimed at finding a smooth approximation of discrete data points, and the computer graphics technique called convolution is aimed at averaging or otherwise combining discrete pixel values; neither addresses the problem of approximating a continuum of values such as a smooth path, and neither addresses the radius of curvature. Although the formulas in the below Appendix are written for 2-dimensional paths, this is for clarity. These formulas have an obvious generalization to a path in three or higher dimensions: Just as y can be substituted for x in the formulas, so can any coordinate in N-dimensional space. After optionally applying the smooth curve generalization formulas, glyphs are positioned along the resulting path as described above in connection with
Defining for one or more glyphs a nonrectangular quadrilateral (such as a trapezoid in which the top and bottom sides are horizontal but one or both of the other two sides may not be vertical), to be used instead of and/or in connection with a glyph box for purposes of achieving path-dependent kerning of adjacent characters (or other glyphs) is disclosed.
Appendix: Smooth Path Generalization in 2D
Objectives: Given a path C in the plane, find a second path {tilde over (C)} that (i) approximates C; (ii) has the same start point and end point; and (iii) has a minimum radius of curvature that is at least as large, and can be made larger by any desired amount up to practical limits that may arise from conditions (i) and (ii).
Solution: Start with a path C expressed in a parameterized form as
where (x,y) are coordinates in the plane R2 (where R represents the set of real numbers) parameter t is the distance from start point (x(0),y(0)) as measured along the path toward endpoint (x(L),y(L)), L is the total length of the path, which we assume to be finite, and x(t), y(t) are functions mapping [0,L] to R that are assumed to have piecewise continuous first derivative.
Extend x(t) and y(t) to all t E R as follows:
If x(L)=x(0) and y(L)=y(0) (a closed path) then set
otherwise (an open path), set
Next, define any “kernel” function k:[0,∞)→[0, ∞) with the properties:
For example, choose any positive real constant W≦L/2 and set
Note that the choice of kernel function will determine the exact manner in which the curve C is approximated and the degree to which the minimum curvature is increased.
Let C1 be defined as the path with
x=x1(t)=x(0)+∫0t∫−∞∞x′(σ)k(|σ−τ|)dσdτ
y=y1(t)=y(0)+∫0t∫−∞∞y′(σ)k(|σ−τ|)dσdτ
C1 shares the same start point as C, and its tangent vector at t is
(x1′(t),y1′(t))=∫−∞∞(x′(σ),y′(σ))k(|σ−t|)dσ
which is a weighted average of the tangent vectors at nearby parameter values σ on C (with weight decreasing to zero as σ moves further from t). By averaging tangent vectors, the rate of variation in path direction with t tends to be reduced, while the path remains close to the original. In particular, since the tangent vector is the first derivative of the position vector, it follows that the maximum magnitude of the second derivative tends to be reduced, and its reciprocal, which is the minimum radius of curvature, tends to be increased. Note that in the example kernel function of equation 1, W is a measure of the size of the neighborhood used in the weighted average, so larger values of W will tend to increase the minimum radius of curvature by more, and will tend toward curve approximations with smaller rate of variation in path direction.
Let C2 be defined as the path with
x=x2(t)=x(L)−∫tL∫−∞∞x′(σ)k(|σ−τ|)dσdτ
y=y2(t)=y(L)−∫tL∫−∞∞y′(σ)k(|σ−τ|)dσdτ
C2 shares the same end point as C, and its tangent vector at t is
(x2′(t),y2′(t))=∫−∞∞(x′(σ),y′(σ))k(|σ−t|)dσ
just as for C1.
Thus C2 is C1 moved via a simple translation (if necessary) so that its endpoint coincides with that of C, rather than its start point. In the special case that C is a closed path, no translation is necessary, and C1=C2.
In order to obtain a solution with the same start and end points as C, we use the following combination {tilde over (C)} of C1 and C2:
The above equation is a weighted average of C1 and C2, where the weights increasingly favor C1 as t→0 and they increasingly favor C2 as t→L. Note that in the special case that C is a closed path, {tilde over (C)}=C1=C2. {tilde over (C)} meets the stated objectives (i), (ii) and (iii) and therefore qualifies as a “smooth path generalization” of C.
Although the foregoing embodiments have been described in some detail for purposes of clarity of understanding, the invention is not limited to the details provided. There are many alternative ways of implementing the invention. The disclosed embodiments are illustrative and not restrictive.
Number | Name | Date | Kind |
---|---|---|---|
4550438 | Convis et al. | Oct 1985 | A |
4742786 | Hashimoto et al. | May 1988 | A |
5539868 | Hosoya et al. | Jul 1996 | A |
5548700 | Bagley et al. | Aug 1996 | A |
5689620 | Kopec et al. | Nov 1997 | A |
5724072 | Freeman et al. | Mar 1998 | A |
5734761 | Bagley | Mar 1998 | A |
5803629 | Neville et al. | Sep 1998 | A |
5805783 | Ellson et al. | Sep 1998 | A |
5809166 | Huang et al. | Sep 1998 | A |
6236390 | Hitchcock | May 2001 | B1 |
6512522 | Miller et al. | Jan 2003 | B1 |
6624814 | Karow et al. | Sep 2003 | B1 |
6643401 | Kashioka et al. | Nov 2003 | B1 |
6687404 | Hull et al. | Feb 2004 | B1 |
6754391 | Carau, Sr. | Jun 2004 | B2 |
6803913 | Fushiki et al. | Oct 2004 | B1 |
6829748 | Browne et al. | Dec 2004 | B1 |
6911980 | Newell et al. | Jun 2005 | B1 |
7028260 | Morsello | Apr 2006 | B1 |
7167274 | McCully | Jan 2007 | B2 |
7320104 | Lynn et al. | Jan 2008 | B2 |
7412360 | Surazhsky et al. | Aug 2008 | B2 |
7453464 | Acquavella | Nov 2008 | B1 |
7492366 | Burago et al. | Feb 2009 | B2 |
7623130 | Burkey | Nov 2009 | B1 |
7752543 | Gerhard et al. | Jul 2010 | B2 |
8121338 | Clermont et al. | Feb 2012 | B2 |
20030200236 | Hong | Oct 2003 | A1 |
20060235825 | Wong et al. | Oct 2006 | A1 |
20100262905 | Li | Oct 2010 | A1 |
Number | Date | Country |
---|---|---|
WO 0063848 | Oct 2000 | WO |
Entry |
---|
Andersson et al. Scalable Vector Graphics (SVG) 1.1 Specification, 10.13.2 The ‘textPath’ element. Jan. 14, 2003: http://www.w3.org/TR/SVG11/text.html#TextPathElement. |
Aycan Gulez, How to Create 3D Text in Illustrator, May 25, 2001. |
Author Unknown, From www.studio.adobe.com , Put Type on a Path, Excerpted from “Real World Adobe Illustrator CS2” Mordy Golding, 2005. |
Author Unknown, Adobe Illustrator Tutorials from Fay Studios, May 11, 2006. |
“InDesign: Creating type on a path”, Adobe, 5 pages. Available at: http://help.adobe.com/en—US/indesign/cs/using/WSa285fff53dea4f8617383751001ea8cb3f-6c4ea.html. |
Anton, Kelly Kordes et al., “Working with Text in Adobe InDesign CS2”, Adobe Press, Jun. 30, 2006, 24 pages. Available at: http://www.adobepress.com/articles/article.asp?p=483800&segNum=4. |
International Preliminary Report on Patentability for International PCT Application No. PCT/US2008/0030073, mailed Sep. 26, 2009, 6 pages. |
International Search Report for International PCT Application No. PCT/US2008/0030073, mailed Jul. 22, 2008, 3 pages. |
International Written Opinion for International PCT Application No. PCT/US2008/0030073, mailed Sep. 26, 2009, 5 pages. |
Number | Date | Country | |
---|---|---|---|
20080238927 A1 | Oct 2008 | US |