This patent application is related to U.S. patent application Ser. No. 10/955,271, now U.S. Pat. No. 7,348,982, entitled “Method, System, and Computer Readable Medium for Creating and Laying Out a Graphic Within an Application Program” filed on Sep. 30, 2004, to U.S. patent application Ser. No. 11/081,323, entitled “Method and Computer-Readable Medium For Generating Graphics Having A Finite Number of Dynamically Sized and Positioned Shapes,” filled concurrently herewith, and to U.S. patent application Ser. No. 10/957,103, entitled “Editing The Text Of An Arbitrary Graphics Via A Hierarchical List,” filed on Sep. 30, 2004, each of which are assigned to the same assignee as this application. The aforementioned patent applications are expressly incorporated herein, in their entirety, by reference.
Today's word processors and dedicated drawing application programs enable users to create both simple and complex graphics. These programs allow users to create graphics using a variety of shapes which may be annotated with text. The graphics created by these applications may be stand-alone documents or incorporated into text documents. Despite the advantages offered by these programs, however, today's versions of these programs suffer from several drawbacks which hinder the creation and layout of graphics by the typical user.
One particular drawback of current drawing programs is that these programs typically utilize defaults for text properties (e.g. margins, line spacing, etc.) that are generic across all shapes and graphics. In most cases, these defaults do not look optimal across a wide range of graphics. As a result, users must manually override the default properties to obtain a professional looking graphic. This can be frustrating and time consuming for users.
Another drawback of current drawing programs is that these programs require a user to manually resize text within shapes as shapes and text are added to graphics. For instance, if a user adds text to a shape that overflows the boundaries of the shape, the user must manually resize the graphic or the text so that the text fits completely within the shape. This problem can be extremely time consuming when a large number of shapes with text are utilized in a graphic. This problem is compounded by the fact that many graphics look best when text is sized equally across related shapes. In order to accomplish this utilizing current drawing programs, a user must manually resize the text in each of the related shapes. This also can be time consuming and frustrating for a computer user.
It is with respect to these considerations and others that the various embodiments of the present invention have been made.
In accordance with the present invention, the above and other problems are solved by a method and computer-readable medium for fitting text into one or more shapes in a graphic. According to the method, one or more initial constraints are defined that comprise initial values describing how a shape and text within the shape should be laid out. For instance, initial constraints may be specified indicating the font face, font size, and character attributes of the text to be laid out. One or more constraint rules are also defined for use in modifying the initial constraints when application of the initial constraints to the text in a shape results in the text overflowing the boundaries of the shape. One or more parameters may be defined that affect the layout of text within a shape but that are not modified by rules.
According to one embodiment of the invention, a change may be detected to the graphic that would affect the size or position of one or more of the shapes or the text within one of the shapes. For instance, a shape may be added or removed, the layout of the graphic may be changed, the font may be changed, or text may be added to or removed from a shape within the graphic. In response to detecting such a change, the initial constraints are applied. If the text overflows the shapes, then the constraint rules are applied sequentially to modify the constraints. The modified constraints are then reapplied to the shapes to create a new layout for the graphic.
According to another embodiment of the invention, applying the constraint rules to modify the constraints includes first identifying a shape in the graphic having text that does not fit inside the shape. When such a shape has been identified, a first constraint rule is identified within a graphic definition file that is associated with the identified shape. The constraint rule identifies a limit for a constraint associated with the shape. A search, such as a binary search, is then performed to identify a value of the constraint between the initial constraint value and the limit that results in the text fitting within the identified shape. According to an embodiment, the identified value comprises a value that is closest to the initial constraint while allowing the text to fit within the shape.
If a value is identified during the search that results in the text fitting within the shape, the identified value for the constraint is applied to the shape. If a value cannot be located that results in the text fitting within the shape, the limit is applied to the shape and a next constraint rule is identified and applied to the shape. Alternatively, an intermediate value identified by the rule may be applied to the shape. In this manner, each of the constraint rules associated with a shape is applied to the shape in a sequential fashion. According to embodiments, rules that do not assist in locating a layout wherein the text fits within the shape may be skipped. If application of all of the constraint rules does not result in the text fitting within the shape, a predefined rule guaranteed to ensure that text does not flow outside the shape may be applied. For instance, a rule may be applied that truncates the text and adds ellipses so that no text extends outside the shape.
According to another embodiment of the invention, a computer-readable medium having a data structure stored thereon is provided. The data structure includes a set of data fields containing data representing one or more initial constraints for fitting text to shapes in a graphic. The constraints comprise initial values describing how text within one or more of the shapes should be laid out.
According to an embodiment, the data structure also includes a second data field containing data representing one or more constraint rules for fitting text to the shapes. The constraint rules comprise rules for modifying the constraints when application of the constraints does not result in text being successfully laid out completely within a shape. In particular, each constraint rule comprises a limit value for at least one constraint. The constraint rules may be utilized to modify the font size, margins, word-wrapping, hyphenation, kerning, line-spacing and other attributes of text within a shape.
The invention may be implemented as a computer process, a computing system, or as an article of manufacture such as a computer program product or computer readable media. The computer program product may be a computer storage media readable by a computer system and encoding a computer program of instructions for executing a computer process. The computer program product may also be a propagated signal on a carrier readable by a computing system and encoding a computer program of instructions for executing a computer process.
These and various other features, as well as advantages, which characterize the present invention, will be apparent from a reading of the following detailed description and a review of the associated drawings.
Referring now to the drawings, in which like numerals represent like elements, various aspects of the present invention will be described. In particular,
Generally, program modules include routines, programs, components, data structures, and other types of structures that perform particular tasks or implement particular abstract data types. Moreover, those skilled in the art will appreciate that the invention may be practiced with other computer system configurations, including hand-held devices, multiprocessor systems, microprocessor-based or programmable consumer electronics, minicomputers, mainframe computers, and the like. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote memory storage devices.
Referring now to
The mass storage device 14 is connected to the CPU 5 through a mass storage controller (not shown) connected to the bus 12. The mass storage device 14 and its associated computer-readable media provide non-volatile storage for the computer 2. Although the description of computer-readable media contained herein refers to a mass storage device, such as a hard disk or CD-ROM drive, it should be appreciated by those skilled in the art that computer-readable media can be any available media that can be accessed by the computer 2.
By way of example, and not limitation, computer-readable media may comprise computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EPROM, EEPROM, flash memory or other solid state memory technology, CD-ROM, digital versatile disks (“DVD”), or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by the computer 2.
According to various embodiments of the invention, the computer 2 may operate in a networked environment using logical connections to remote computers through a network 18, such as the Internet. The computer 2 may connect to the network 18 through a network interface unit 20 connected to the bus 12. It should be appreciated that the network interface unit 20 may also be utilized to connect to other types of networks and remote computer systems. The computer 2 may also include an input/output controller 22 for receiving and processing input from a number of other devices, including a keyboard, mouse, or electronic stylus (not shown in
As mentioned briefly above, a number of program modules and data files may be stored in the mass storage device 14 and RAM 9 of the computer 2, including an operating system 16 suitable for controlling the operation of a networked personal computer, such as the WINDOWS XP operating system from MICROSOFT CORPORATION of Redmond, Wash. The mass storage device 14 and RAM 9 may also store one or more program modules. In particular, the mass storage device 14 and the RAM 9 may store a drawing application program 10. The drawing application program 10 is operative to provide functionality for the creation and layout of graphics, such as the graphic 24. According to one embodiment of the invention, the drawing application program 10 comprises any one of the programs in the OFFICE suite of application programs from MICROSOFT CORPORATION including the WORD, EXCEL, and POWERPOINT application programs.
The mass storage device 14 may also store several components which are utilized in the creation and layout of graphics within the drawing application program 10. In particular, the components may include a data model 30 and a graphic definition file 40. In various embodiments of the invention, the drawing application program 10 reads in the graphic definition file 40 for instructions regarding the creation and layout of graphics. It will be appreciated that in one embodiment of the invention, the data model 30 and the graphic definition file 40 may be stored as individual files in the computer system 2 which are accessed by the drawing application program 10.
The data model 30 includes a collection of nodes, relationships, text, and properties that contains the content for constructing the graphic 24. The graphic definition file 40 is a collection of data which describes how to create a specific graphic layout. In various embodiments of the invention, the graphic definition file 40 may be formatted utilizing the extensible markup language (“XML”). As is understood by those skilled in the art, XML is a standard format for communicating data. In the XML data format a schema is used to provide XML data with a set of grammatical and data type rules governing the types and structures of data that may be communicated. The XML data format is well-known to those skilled in the art, and therefore not discussed in further detail herein. The aspects of a graphic described by the graphic definition file 40 include the name of the layout algorithm to use for each layout node, algorithm parameters, constraints, and constraint rules for constructing the layout tree, defaults for shape geometry and style properties, graphic classification data, and a sample data model. Additional details regarding the contents and use of the graphic definition file 40 can be found in U.S. patent application Ser. No. 10/955,271, now U.S. Pat. No. 7,348,982, entitled “Method, System, and Computer Readable Medium for Creating and Laying Out a Graphic Within an Application Program” filed on Sep. 30, 2004, which is expressly incorporated herein by reference.
Constraints are conditions used by a layout algorithm for creating a graphic. An example of a constraint is the value to be used for a shape's width. It will be appreciated that constraints may include numeric values or Boolean values. Numeric constraints can specify a specific numeric value (e.g., width=1 inch). Numeric constraints may also calculate their value by referring to other constraint values using references (e.g., height=width*0.75). Boolean constraints may include equality constraints which force all nodes in a set to have the same value as another constraint, and may include inequality constraints, where one constraint value is limited based on another constraint value (e.g. shape's width needs to be less-than or greater-than another shape's height).
Constraints may be propagated between layout nodes to enforce equality between drawing elements (e.g., all normal nodes have the same font size) or inequality (e.g., width of transition nodes should be <=normal node width). Constraints may be propagated by attaching a shared propagator to a constraint which propagates its states to other layout nodes. It will be appreciated that both constraints and constraint rules may be updated on the other nodes from the propagating constraint.
Constraint rules are a description of how to modify a set of constraints if they are unable to be met by a layout algorithm. For instance, a constraint may specify that a font size must be 14 points, but a constraint rule may specify that a font size can decrease to a minimum of 8 points.
According to one embodiment of the invention, the constraints comprise initial values describing how a shape and text within the shape should be laid out. In this regard, constraint rules may be specified that comprise rules for modifying the constraints when application of the constraints does not result in text being successfully laid out within the boundaries of a shape. Additional details regarding the structure and use of the constraints and constraint rules and the contents of the graphic definition file 40 will be provided below with respect to
Referring now to
According to one embodiment of the invention, text alignment across multiple shapes may also be modified dynamically based on data changes. For instance, in response to adding bullets to the text 52B, the alignment of the text 52B may be changed from centered to left aligned as described above. Additionally, the alignment of the text 52A and 52C in the shapes 50A and 50B may also be changed from centered to left aligned in response to the changes to the text 52B. This is reflected in the text 52A and 52C shown in
Turning now to
Referring now to
Turning now to
As will be described in greater detail below, the graphic definition file 40 includes constraint rules that define which attributes of the shape 50F and text 52D should be modified in attempt to fit the text 52D and the order in which they should be modified. It should be appreciated that the attributes of the shape 50F and text 52D shown in
Referring now to
The graphic definition file also includes one or more constraint rules 62. The constraint rules 62 are a description of how to modify a set of constraints if they are unable to be met by a layout algorithm. For instance, the constraint rules 62 shown in
Referring now to
The routine 700 begins at operation 702, where the initial constraint values are defined. The routine 700 then continues to operation 704, where the constraint rules are defined. From operation 704, the routine 700 continues to operation 706, where the constraint values and constraint rules are stored in the graphic definition file 40. The routine 700 then continues to operation 708, where it ends.
Referring now to
The routine 800 begins at operation 810 if the graphic type is modified. In this case, a selection of the new graphic type is received at operation 810. From operation 810, the routine 800 continues to operation 814, described below.
At operation 814, the text content is mapped to shapes within the graphic. The routine 800 then continues to operation 816 where the initial constraints are applied to the shapes. Parameters may also be applied to the shapes. For instance, color may be a parameter since modifying the color of text will not change the size or position of the text. From operation 816, the routine 800 continues to operation 818.
At operation 818, a determination is made as to whether the text fit into each of the shapes. If the text does not fit, the routine 800 continues to operation 820, where a determination is made as to whether there are additional constraint rules in the graphic definition file to process. If additional constraint rules remain to be processed, the routine continues to operation 822. At operation 822, the next constraint rule is read from the graphic definition file. The routine 800 then continues to operation 824, where the set of values specified in the constraint rule is searched to determine the best fit for the text. For instance, if the initial constraint specifies that the width of the shape should be 1.5 inches and the constraint rule specifies that the width may be increased to a limit of 3 inches, a search is performed to identify the smallest value between 1.5 and 3 inches that will result in the text fitting within the shape. According to one embodiment, a binary search is utilized. However, it should be appreciated that other type of algorithms may be utilized to identify the best fit value in addition to search algorithms.
It should be appreciated that, according to one embodiment of the invention, a modified binary search algorithm is utilized that continues searching for a value that is closer to the starting value, even after a successful value has been located. This process continues until the first result that allows a fit is within a predefined threshold of a subsequent value that results in a fit. In this manner, a best fit value can be located.
Once the search for a best fit value has been performed utilizing the current constraint rule, the method 800 returns to operation 818 where another determination is made as to whether the text fits within the shape. If the text does not fit, the above process is repeated with respect to operations 820, 822, and 824. If the text does fit, the routine 800 branches from operation 818 to operation 828.
It should be appreciated that, according to one embodiment, the values identified by the search routine as the best fit for the shape having overflowing text may be propagated to other shapes. In this manner, related shapes may be resized for consistency thereby saving users from having to manually resize related shapes.
At operation 828, a determination is made as to whether there have been changes to the size or position of any content within the graphic. If there have not been changes, the routine 800 branches to operation 832, where it ends. If there have been changes, the routine 800 branches to operation 826, where a determination is made as to whether there is new content to be mapped to a shape within the graphic. If there is new content to be mapped, the routine 800 branches from operation 826 to operation 814, described above. If there is no new content to be mapped, the routine branches from operation 826 to operation 816, described above.
If, at operation 820, it is determined that there are no additional constraint rules to process then the routine 800 branches from operation 820 to operation 830. At operation 830, a predefined rule is applied to the shape that is guaranteed to ensure that text does not flow outside the shape. For instance, according to one embodiment of the invention, the text may be truncated and ellipses (“ . . . ”) added to the end of the text to indicate the truncation. Sufficient text may be truncated so that the remaining text fits entirely within the shape. Other types of rules guaranteed to ensure that text will not flow outside the shape may be applied. From operation 830, the routine 800 branches to operation 828, described above.
Based on the foregoing, it should be appreciated that the various embodiments of the invention include a method and computer-readable medium for fitting text to shapes within a graphic. The above specification, examples and data provide a complete description of the manufacture and use of the composition of the invention. Since many embodiments of the invention can be made without departing from the spirit and scope of the invention, the invention resides in the claims hereinafter appended.
Number | Name | Date | Kind |
---|---|---|---|
5214755 | Mason | May 1993 | A |
5426729 | Parker | Jun 1995 | A |
5557722 | DeRose | Sep 1996 | A |
5596691 | Good et al. | Jan 1997 | A |
5619631 | Schott | Apr 1997 | A |
5649216 | Sieber | Jul 1997 | A |
5669006 | Joskowicz et al. | Sep 1997 | A |
5732229 | Dickinson | Mar 1998 | A |
5818447 | Wolf et al. | Oct 1998 | A |
5903902 | Orr et al. | May 1999 | A |
5909220 | Sandow | Jun 1999 | A |
5956737 | King et al. | Sep 1999 | A |
5999731 | Yellin et al. | Dec 1999 | A |
6057842 | Knowlton et al. | May 2000 | A |
6057858 | Desrosiers | May 2000 | A |
6081816 | Agrawal | Jun 2000 | A |
6166738 | Robertson et al. | Dec 2000 | A |
6173286 | Guttman et al. | Jan 2001 | B1 |
6189132 | Heng et al. | Feb 2001 | B1 |
6204859 | Jouppi et al. | Mar 2001 | B1 |
6256650 | Cedar et al. | Jul 2001 | B1 |
6289502 | Garland et al. | Sep 2001 | B1 |
6289505 | Goebel | Sep 2001 | B1 |
6301704 | Chow et al. | Oct 2001 | B1 |
6305012 | Beadle et al. | Oct 2001 | B1 |
6308322 | Serocki et al. | Oct 2001 | B1 |
6324686 | Komatsu et al. | Nov 2001 | B1 |
6405225 | Apfel et al. | Jun 2002 | B1 |
6667750 | Halstead et al. | Dec 2003 | B1 |
6826727 | Mohr et al. | Nov 2004 | B1 |
6944830 | Card et al. | Sep 2005 | B2 |
6956737 | Chen et al. | Oct 2005 | B2 |
7055095 | Anwar | May 2006 | B1 |
7107525 | Purvis | Sep 2006 | B2 |
7178102 | Jones et al. | Feb 2007 | B1 |
7348982 | Schorr et al. | Mar 2008 | B2 |
7379074 | Gerhard et al. | May 2008 | B2 |
7423646 | Saini et al. | Sep 2008 | B2 |
20010051962 | Plotkin | Dec 2001 | A1 |
20020065852 | Hendrickson et al. | May 2002 | A1 |
20020111969 | Halstead, Jr. | Aug 2002 | A1 |
20030079177 | Brintzenhofe et al. | Apr 2003 | A1 |
20040111672 | Bowman et al. | Jun 2004 | A1 |
20040133854 | Black | Jul 2004 | A1 |
20040148571 | Lue | Jul 2004 | A1 |
20040205602 | Croeni | Oct 2004 | A1 |
20050007382 | Schowtka | Jan 2005 | A1 |
20050091584 | Bogdan et al. | Apr 2005 | A1 |
20050094206 | Tonisson | May 2005 | A1 |
20050132283 | Diwan et al. | Jun 2005 | A1 |
20050157926 | Moravec | Jul 2005 | A1 |
20050273730 | Card et al. | Dec 2005 | A1 |
20050289466 | Chen | Dec 2005 | A1 |
20060064642 | Iyer | Mar 2006 | A1 |
20060066627 | Gerhard et al. | Mar 2006 | A1 |
20060066631 | Schorr et al. | Mar 2006 | A1 |
20060070005 | Gilbert | Mar 2006 | A1 |
20060209093 | Berker et al. | Sep 2006 | A1 |
20060277476 | Lai | Dec 2006 | A1 |
20060294460 | Chao et al. | Dec 2006 | A1 |
20070006073 | Gerhard et al. | Jan 2007 | A1 |
20070055939 | Furlong et al. | Mar 2007 | A1 |
20070112832 | Wong | May 2007 | A1 |
20080046803 | Beauchamp et al. | Feb 2008 | A1 |
20080136822 | Schorr et al. | Jun 2008 | A1 |
20080282147 | Schorr | Nov 2008 | A1 |
20080288916 | Tazoe | Nov 2008 | A1 |
20090019453 | Kodaganur | Jan 2009 | A1 |
20090327954 | Danton | Dec 2009 | A1 |
Number | Date | Country |
---|---|---|
0 431 638 | Jun 1991 | EP |
1 111 543 | Jun 2001 | EP |
1 111 543 | Jun 2001 | EP |
WO 0139019 | May 2001 | WO |
WO 03052582 | Jun 2003 | WO |
WO 2004046972 | Jun 2004 | WO |
Number | Date | Country | |
---|---|---|---|
20060212801 A1 | Sep 2006 | US |