Field of the Invention
The present invention relates to an information processing apparatus, an information processing method, and a program.
Description of the Related Art
Mobile computers such as a smartphone and a tablet terminal are further advancing, and wearable computers such as a head mounted display and a watch are becoming widespread. As devices themselves are miniaturized, device display units are also becoming smaller. Many devices even with such a small display unit often display a character string on the display unit, using the display unit as a user interface. Display units, as typified by a watch, are no longer limited to a rectangular shape. Japanese Patent Application Laid-Open No. 2011-248575 discusses a technique for label printing on a portable medium of circular shape, for example. According to the technique, an upper reference position and a lower reference position for character layout are provided in a printing area. If an upper portion of an area available for layout lies above the upper reference position, the upper portion is shifted to below the upper reference position. If a lower portion of the area available for layout lies below the lower reference position, the lower portion is shifted to above the lower reference position.
According to the conventional technique, if a character string is displayed as though it were poured into a display area of a device, whether a character exceeds the display area is determined based on a rectangular character area determined by a feed width of the character string and a height (character size) of the character. While the determined character area is rectangular, the display area is not necessarily limited to a rectangular shape. Therefore, it can be determined that a character runs over the display area even if a letter form of the character fits in the display area. There has thus been a problem in that the limited display area cannot be efficiently used.
Aspects of the present invention are directed to effectively using a limited display area for character display.
According to an aspect of the present invention, an information processing apparatus includes a derivation unit configured to derive a length by which a position of a head character laid out at a beginning of a line or column of characters displayed in a display area of a display unit can be changed within a range in which a letter form of the head character does not exceed the display area, and an adjustment unit configured to adjust the layout position of the head character and that of a character subsequent to the head character based on the length.
Further features of the present invention will become apparent from the following description of exemplary embodiments with reference to the attached drawings.
Exemplary embodiments of the present invention will be described below with reference to the drawings.
A configuration of an information processing apparatus 100 according to the present exemplary embodiment will be described with reference to
The CPU 101 executes processing based on the programs stored in the ROM 102 to implement a software configuration of the information processing apparatus 100 and processing of flowcharts to be described below.
Storage media for supplying the programs to the foregoing configuration, aside from the ROM 102, will be described. For example, a flexible disk, a hard disk, an optical disk, a magneto-optical disk, a compact disc read-only memory (CD-ROM), a compact disk-recordable (CD-R), a magnetic tape, a memory card, and/or a digital versatile disc (DVD) may be added to the configuration of the information processing apparatus 100 according to the present exemplary embodiment.
In a first exemplary embodiment, an example of character layout processing with respect to an end-of-line character near a boundary of a display area when a character string is displayed as though it were poured into the display unit 106 of circular shape will be described with reference to the drawings.
In step S301, a character information acquisition unit 201 obtains character information to be displayed in the display area. As employed herein, the character information is assumed to be stored in the ROM 102 or the RAM 103. However, input data received from the user by the input unit 104 may also include character information, which the character information acquisition unit 201 may obtain for display.
In step S302, a display area information acquisition unit 202 obtains display area information which is shape information about the display unit 106. The display area information acquisition unit 202 can obtain the display area information from the ROM 102 or the RAM 103. In the present exemplary embodiment, a circular shape is assumed. The display area information obtained by the display area information acquisition unit 202 includes center coordinates and a radius of the circle with the top left as an origin. However, the display area does not need to have a circular shape. The display area may be an arbitrary closed convex area, and the display area information acquisition unit 202 may obtain path information defining the shape. A closed convex area refers to an area having the shape defined by a closed path and a line segment connecting any two points inside the closed area is included in the area.
In step S303, a line position determination unit 203 determines a layout position of each line when the character string (character information) is poured into the display area, based on the premise that a predetermined font size is unchanged.
An example of a method for determining the layout position of the first character in the display area of circular shape will be described with reference to
In step S304, a metrics information acquisition unit 204 obtains metrics information about a character obtained by the character information acquisition unit 201. To lay out and display the character, the metric information includes at least shape information about the character, and information about a feed width of the character. The metrics information acquisition unit 204 is assumed to obtain the metrics information from font data stored in the ROM 102 or an external storage unit. The stored font data may be either an outline font or a bitmap font.
The metrics information about a character will be described with reference to ” and a letter form origin 505 of the next character “, ” is a character feed width 506 of the character “
”. Such metrics information is stored in the font data. Characters of the same font data have the same ascending height and the same descending height. However, the character feed width may differ depending on a character. In proportional fonts, the value of the character feed width varies character by character. In the present exemplary embodiment, a hatched rectangular area 507 expressed by the character feed width, the ascending height, and the descending height will be referred to as a character area. The head character of a line is laid out so that the top left of the character area coincides with the top left of the display area of the line indicated by the rectangle 404 of
In step S305, a character area determination unit 205 determines character by character whether the character area obtained by the metrics information acquisition unit 204 fits in the display area obtained by the display area information acquisition unit 202. If the character area determination unit 205 determines that the character area fits in the display area (YES in step S305), the processing proceeds to step S306.
In step S306, a character layout position determination unit 206 determines the layout position of the character.
In step S307, the character layout position determination unit 206 determines whether there is a next character to be processed. If there is no next character (NO in step S307), that is, all the characters have been displayed by this line, then the processing of the flowchart illustrated in
In step S308, the character layout position determination unit 206 assumes the next character to be the character to be processed. The processing proceeds to step S304.
A case where the character area determination unit 205 determines in step S305 that the character area does not fit in the display area will be described with reference to ” obtained by the character information acquisition unit 201 as if the character string is poured in from the upper portion of the circle 601.
”. A punctuation mark “, ” is laid out in the next line after a line break. A rectangle 602 represents the character area of the punctuation mark if the punctuation mark “, ” is laid out there. According to the conventional technique, the rectangle 602 exceeds the circle 601 in the top right portion and therefore the character associated with rectangle 602 is determined to not fit in the display area on the same line as the preceding character(s). However, the rectangle 602 runs over the boundary of the circle only in the top right portion of the circle, and the letter form of the punctuation mark fits in the circle 601 if only a size of the letter form “, ” is considered.
”, respectively. As described above, the rectangles 701 and 702 are formed according to the feed width and font size (line height) of the characters. In many typical character display devices, whether characters fit in a display area is determined with reference to their character areas. A hatched area 703 and a hatched area 704 represent minimum rectangular areas including the respective letter forms. As compared to the character areas, with the minimum inclusive rectangular areas of the letter forms, whether the letters run over the boundaries of the display area can be more accurately determined. However, the inclusive rectangular areas are also constituted by horizontal and vertical sides. As illustrated by a frame 705, some characters may have many areas lacking letter forms within their inclusive rectangular area. In
” are located among the divided areas. Occupation areas are less strict compared with the inclusive rectangular areas, but can extract portions closer to a feature of the letter form of some characters such as “
”. In the present exemplary embodiment, an occupation area is defined as a sum set of divided areas where there is a portion of a letter form when a character area is divided into a predetermined pattern. However, a minimum rectangular area including a letter form as described above may be used as an occupation area.
” is both vertically and horizontally divided into two and a sum set of the shaded areas including a letter form 1505 serves as an occupation area 1506. In
” is both vertically and horizontally divided by four into a total of 16 rectangular areas and the sum set of the shaded areas including a letter form 1511 serves as an occupation area 1512.
As illustrated in
If the character area determination unit 205 determines that the character area overlaps the boundary line of the display area (NO in step S305), the processing proceeds to step S309.
In step S309, the character area determination unit 205 determines whether the character is included in the table information. If it is determined that the character is not included in the table information (NO in step S309), the processing proceeds to step S310. Characters included in the table information are an example of a specific character.
In step S310, the character layout position determination unit 206 shifts the current position to the next line, ending the processing of the line so far.
If the character area determination unit 205 determines that the character is included in the table information (YES in step S309), the processing proceeds to step S311.
In step S311, an occupation area information acquisition unit 207 obtains the occupation area information about the character described in
In step S312, an occupation area determination unit 208 determines whether the obtained occupation area fits in the display area. An example of the determination method will be described below. If the occupation area determination unit 208 determines that the occupation area fits in the display area (YES in step S312), the processing proceeds to step S306. If not (NO in step S312), the processing proceeds to step S310. In other words, if the CPU 101 determines that the occupation area fits in the display area, the CPU 101 determines that the layout position of the process target character comes at a rear position in the same line or column, after the character immediately previous to the process target character. On the other hand, if the CPU 101 determines that the occupation area does not fit in the display area, the CPU 101 determines the layout position of the process target character is to be placed in a line or column different from the character immediately previous to the process target character.
An example of the determination method of the occupation area determination unit 208 will be described with reference to the flowchart of ” have been already determined to fit in a display area 901, and it is determined that a character area 903 of a character “, ” does not fit in the display area 901.
In step S801, the occupation area determination unit 208 obtains coordinate information about intersections 904 and 905 of the boundary line of the display area 901 and the character area 903.
In step S802, the occupation area determination unit 208 obtains an equation that represents a straight line connecting the two intersections. A hatched area 906 surrounded by the straight line connecting the two intersections, and the boundary lines of the character area 903 approximates the area included in the display area 901.
In step S803, the occupation area determination unit 208 determines whether the occupation area 706 of the character “, ” illustrated in
A case where in step S803 it is determined that the occupation area does not fit in the display area 901 will be described with reference to
In step S805, the occupation area determination unit 208 obtains a hatched occupation area 909 of a character “” immediately previous to the character “, ”.
In step S806, the occupation area determination unit 208 determines, based on the occupation area 909 of the character “”, whether the occupation area 907 and the occupation area 909 overlap when the layout position of the character “, ” is moved to the left by the value X of the maximum width 908. If it is determined that the occupation areas 907 and 909 overlap with each other (YES in step S806), the processing proceeds to step S807.
In step S807, the occupation area determination unit 208 determines that the character “, ” does not fit in the display area 901. The processing of the flowchart of
In step S808, the occupation area determination unit 208 moves the occupation area 907 to the left by the value X as illustrated in ”.
In step S809, the occupation area determination unit 208 determines that the character “” fits in the display area 901 and the processing of the flowchart of
In the first exemplary embodiment, the processing for laying out an end-of-line character in the display area of circular shape has been described in a case where the end-of-line character is a special character having an occupation area on the left side of its character area, like Japanese punctuation marks. However, the CPU 101 may store information about the occupation areas of all the characters stored in the font data in the ROM 102 in advance and perform the processing on all the characters, not just symbols such as punctuation marks. The processing has been described by using character strings displayed from left to right like western languages. However, the same algorithm can be applied to character strings displayed from right to left like Arabic and ones displayed from top to bottom like Japanese, with only a difference in the changing direction of the layout position of a character.
In a second exemplary embodiment, an example of character layout processing near the boundary of the display area at the beginning of a line when a character string is displayed as though it were poured into the display unit 106 of circular shape will be described according to the flowchart illustrated in
” does not exceed the display area 1101. It is determined that the characters up to the end-of-line character “
” of the first line are determined to fit in the display area 1101. It is determined that a character area 1103 of the next character “
” does not fit in the display area 1101 and is thus laid out at a head position 1105 in the next line. Depending on the positions of a hatched occupation area 1104 of the head character “
” and the boundary line of the display area 1101, the layout positions of all the characters in the first line may be moved to the left without the occupation area 1104 exceeding the display area 1101.
Similarly,
The processing of the flowchart illustrated in
The processing of steps S301 to S305 in
In step S1002, the occupation area determination unit 208 calculates a width X by which the layout position can be moved to the left without the occupation area exceeding the display area, based on the obtained occupation area information and the display area information obtained in step S302. The occupation area determination unit 208 stores the value of the width X. A method for calculating the width X will be described below. The calculation of the width X is an example of derivation of the width X. The width X will not be referred to in the processing of step S306. In step S307, if the character layout position determination unit 206 determines that there is no next character (NO in step S307), the processing of the flowchart illustrated in
As another method for determining the width X, the leftmost pixel of each drawing stroke of the head character may be detected to calculate a distance from the pixel position to the boundary line of the display area.
In step S1003, the character area determination unit 205 determines whether the character area fits in the display area when the characters of which the layout positions have already been determined in the current line, are moved to the left by the width X as a whole. If it is determined that the character area fits in the display area (YES in step S1003), the processing proceeds to step S1004. The processing of step S1003 is an example of processing for determining whether the character area of the process target character fits in the display area of the display unit when the characters of which the layout positions have already been determined in the current line or column, are moved in the foregoing direction by the width X.
In step S1004, when the layout positions of the characters is already determined in the current line, the character layout position determination unit 206 updates the layout positions of the respective characters, which are moved to the left by the width X.
In step S1005, the character area determination unit 205 initializes the width X to zero. In step S308, the character layout position determination unit 206 shifts the processing to the next character.
The processing of step S1003 is an example of processing for determining whether the character area of the character to be processed fits in the display area of the display unit (i.e., determining whether a character in the next line fits in the current line) when the characters of which the layout positions have already been determined in the current line or column, are shifted in the foregoing direction by the width X. However, the head character of a line may be moved in the foregoing direction regardless of whether the character in the next line fits in the current line. In such a case, the character layout position determination unit 206 finds a length by which the layout position of the head character can be changed within a range in which the letter form of the head character does not exceed the display area, and adjusts the layout position based on the length. An example of such a processing flow will be described with reference to
The processing of steps S301 to S304 is similar to that of
” in the state illustrated in
” fits in the display area 1101. In step S1003, if it is determined that the character area does not fit in (NO in step S1003), the processing proceeds to step S1006. In step S1006, the character layout position determination unit 206 resets the width X to zero without updating the layout positions. In step S310, the character layout position determination unit 206 shifts the processing to the next line, ending the processing of the current line.
An example of the method for calculating the width X of possible movement to the left in step S1002 will be described with reference to ” illustrated in
The occupation area determination unit 208 obtains the y coordinates of vertexes of the occupation area 1203. The values of the y coordinates to be obtained are those of vertexes 1204, 1205, and 1206. Horizontal lines passing through the respective y coordinates form intersections 1207, 1208, and 1209 with the boundary line 1201. Since the display area is circular in shape, the occupation area determination unit 208 can determine the coordinates of the intersections 1207, 1208, and 1209 by using a function representing the circle. The horizontal lines each have two intersections. A horizontal line forms only one intersection if the horizontal line is a tangent to the circle. However, to include the character area within the circle, the horizontal lines always have two intersections each. The width from the vertex 1204 to the intersection 1207 will be denoted by W1. The width from the vertex 1205 to the intersection 1208 will be denoted by W2. The width from the vertex 1206 to the intersection 1209 will be denoted by W3. The occupation area determination unit 208 determines the minimum value of width among W1, W2, and W3 as the value of the width X. In
In the second exemplary embodiment, an example of the method for determining the width in which the head character can be moved to the left based on the occupation area, and changing the layout positions of characters according to the width, has been described. Alternatively, specific characters may be registered in advance as ones that can be moved to the left. If the head character of a line corresponds to one of the specific registered characters, the character layout position determination unit 206 performs processing for changing the layout position of the character based on information about the movable width. If the head character does not correspond to any of the specific characters, the character layout position determination unit 206 does not change the layout position of the character. In step S1001 of
In a third exemplary embodiment, a method for switching the shape of the display area depending on whether an entire character string laid out like being poured into the display unit 106 of circular shape fits in the display area will be described with reference to
If the input character strings in
For example, when it is determined that a character string does not fit in the display area 1301, the character layout position determination unit 206 switches to a new display area such as a rectangle 1303 and a rectangle 1306 which fit in the display area 1301 as illustrated in
An example of such information processing related to the changing of the display area will be described with reference to the flowchart illustrated in
Metrics information about the characters is obtained in order from the head character. In step S1401, the character area determination unit 205 determines whether the character area fits in the display area 1301 in the current line. If the character in process is a specific character at the end of the line, the information processing apparatus 100 may perform the character layout processing described in the first exemplary embodiment. If the character in process is the head character of the line, the information processing apparatus 100 may perform the character layout processing described in the second exemplary embodiment. In step S1401, if it is determined that the character area fits in the display area 1301 (YES in step S1401), the processing proceeds to step S306.
In step S306, the character layout position determination unit 206 determines the layout position of the character. If there is no next character (NO in step S307), the processing of the flowchart illustrated in
In step S1401, if it is determined that the character area does not fit in the display area (NO in step S1401), the processing proceeds to step S1402.
In step S1402, the character area determination unit 205 determines whether there is an area available for laying out a next line in the display area 1301. If it is determined that there is an area available for laying out a next line (YES in step S1402), the processing proceeds to step S310.
In step S310, the character layout position determination unit 206 shifts to the head character of the next line and the processing proceeds to step S1401. On the other hand, if it is determined that there is no area available for laying out a next line (NO in step S1402), the processing proceeds to step S1403.
In step S1403, the character layout position determination unit 206 discards information about the already-determined layout positions of characters, and changes the shape of the display area. The shape and size of the changed display area are not particularly limited. In the present exemplary embodiment, for the sake of simplification of the character layout processing, the character layout position determination unit 206 changes the shape of the display area to a square, such as the rectangle 1303 of
In step S1404, the character layout position determination unit 206 lays out the character string again in the rectangle 1303. The character layout position determination unit 206 lays out the character areas of the characters as if paved rightward in order from the top left of the rectangle 1303. If the character areas no longer fit in the line, the character layout position determination unit 206 shifts the processing to the next line. In such a manner, the character layout position determination unit 206 repeats the layout processing until no more characters fit in the rectangle 1303.
In the second exemplary embodiment, an example of the information processing has been described in which the start position is moved to the left based on the occupation area of the head character if the character area of the end-of-line character of that line does not fit in the display area. In the present exemplary embodiment, the head character of a line is laid out close up to the left boundary so that the occupation area fits in the display area, regardless of whether the end-of-line character fits in. If there is a margin on the right after characters are laid out up to the end character of the line, the layout positions are adjusted so that the character string comes to the center of the area where the lay-out is possible. An example of such information processing will be described with reference to
The processing up to step S304 of
In step S1001, the character area determination unit 205 determines whether the character is the head character of the line. If it is determined that the character is the head character (YES in step S1001), the processing proceeds to step S311. In step S311, the occupation area information acquisition unit 207 obtains the occupation area information. In step S1002, the occupation area determination unit 208 calculates the width X in which the layout position can be further moved to the left from the start position where the character area fits in the display area, based on a positional relationship between the boundary line of the display area, and the occupation area. The calculation of the width X is an example of the derivation of the width X.
In step S1601, the character layout position determination unit 206 determines the layout position of the character from the calculated width X. In step S1001, if it is determined that the character is not the head character (NO in step S1001), the processing proceeds to step S305. In step S305, the character area determination unit 205 determines whether the character area fits in the display area. If it is determined that the character area fits in the display area (YES in step S305), the processing proceeds to step S1601. If it is determined that the character area does not fit in the display area (NO in step S305), the processing proceeds to step S311. In step S311, the occupation area information acquisition unit 207 obtains the occupation area information. In step S312, the occupation area determination unit 208 determines whether the occupation area fits in the display area. If it is determined that the occupation area fits in the display area (YES in step S312), the processing proceeds to step S1601. If it is determined that the occupation area does not fit in the display area (NO in step S312), the processing proceeds to step S1602.
In step S1602, the character layout position determination unit 206 adjusts the layout positions of the characters. The character layout position determination unit 206 determines a width T by subtracting the x coordinate of the right end of the character area related to the immediately previous character from the x coordinate of the boundary line of the display area closer to the end character of the line. If the width T is smaller than or equal to a predetermined threshold, the character layout position determination unit 206 moves the layout position of the entire character string in that line to the right by T/2. The processing of step S1602 is an example of processing for adjusting the already determined layout positions of characters in the current line or column to move in a direction opposite from step S1002 if it is determined that the occupation area does not fit in the display area.
An exemplary embodiment of the present invention may be realized by supplying a program for implementing one or more functions of the foregoing exemplary embodiments to a system or an apparatus via a network or a recording medium, and reading and executing the program by one or more processors of a computer in the system or apparatus. An exemplary embodiment of the present invention may be realized by using a circuit (for example, an application specific integrated circuit (ASIC)) that implements one or more of the functions.
The exemplary embodiments of the present invention have been described in detail above. However, the present invention is not limited to such specific exemplary embodiments. For example, the software configuration illustrated in
As described above, according to the processing of the foregoing exemplary embodiments, the limited display area of the display unit 106 can be effectively used for character display.
According to an exemplary embodiment of the present invention, a limited display area can be effectively used for character display.
Embodiment(s) of the present invention can also be realized by a computer of a system or apparatus that reads out and executes computer executable instructions (e.g., one or more programs) recorded on a storage medium (which may also be referred to more fully as a ‘non-transitory computer-readable storage medium’) to perform the functions of one or more of the above-described embodiment(s) and/or that includes one or more circuits (e.g., application specific integrated circuit (ASIC)) for performing the functions of one or more of the above-described embodiment(s), and by a method performed by the computer of the system or apparatus by, for example, reading out and executing the computer executable instructions from the storage medium to perform the functions of one or more of the above-described embodiment(s) and/or controlling the one or more circuits to perform the functions of one or more of the above-described embodiment(s). The computer may comprise one or more processors (e.g., central processing unit (CPU), micro processing unit (MPU)) and may include a network of separate computers or separate processors to read out and execute the computer executable instructions. The computer executable instructions may be provided to the computer, for example, from a network or the storage medium. The storage medium may include, for example, one or more of a hard disk, a random-access memory (RAM), a read only memory (ROM), a storage of distributed computing systems, an optical disk (such as a compact disc (CD), digital versatile disc (DVD), or Blu-ray Disc (BD)™), a flash memory device, a memory card, and the like.
While the present invention has been described with reference to exemplary embodiments, it is to be understood that the invention is not limited to the disclosed exemplary embodiments. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.
This application claims the benefit of Japanese Patent Application No. 2015-197791, filed Oct. 5, 2015, which is hereby incorporated by reference herein in its entirety.
Number | Date | Country | Kind |
---|---|---|---|
2015-197791 | Oct 2015 | JP | national |