Text typesetting method, device, electronic device and computer-readable storage medium
By obtaining and utilizing the multi-directional font size information of text in text and independently adjusting the width and height of text, the problem of being unable to independently adjust the text size in the prior art is solved, and flexible control of the text size is achieved.
Patent Information
- Application Number
- CN202110668705.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-16
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2041-06-16
AI Technical Summary
When adjusting the size of text in text, the prior art cannot independently adjust the width or height of the text, which cannot meet the user's requirement to change the text width without changing the text height, or to change the text height without changing the text width.
By obtaining the first font size in the first direction of the text and the second font size information in the second direction, the size of the text is adjusted so that its size in the first direction matches the first font size, and the size in the second direction matches the second font size.
The function of independently adjusting the text width and height is realized, meeting the user's flexible needs for text size in actual typesetting.
Smart Images

Figure CN113657085B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer technology, and more specifically, to a text typesetting method, device, electronic device, and computer-readable storage medium. Background Art
[0002] When typesetting text, you can set the size of the text by setting the font size of the text. When the font size of the text changes, the width and height of the text will change accordingly.
[0003] However, in actual typesetting, when the font of the text does not change, the user may only need to modify one of the width and height, such as changing the width of the text without changing the height of the text, or changing the height of the text without changing the width of the text. Currently, the above needs of users cannot be met by simply setting the font size of the text. Summary of the invention
[0004] One purpose of the embodiments of the present disclosure is to provide a new technical solution for text typesetting to solve the problem in the prior art that when adjusting the size of characters in a text, the width or height of the characters cannot be adjusted independently.
[0005] According to a first aspect of the present disclosure, a text typeset method is provided, the method comprising: obtaining font size information set for characters in the text; wherein the font size information comprises a first font size of the characters in a first direction and a second font size of the characters in a second direction; adjusting the size of the characters according to the font size information to obtain adjusted characters; wherein the size of the adjusted characters in the first direction matches the first font size, and the size in the second direction matches the second font size.
[0006] Optionally, adjusting the size of the text according to the font size information includes: when the first font size is different from the second font size, adjusting parameter values of at least two size parameters of the text according to the first font size and the second font size; and adjusting the size of the text according to the adjusted parameter values.
[0007] Optionally, at least two size parameters include a font size parameter and a character scaling ratio parameter; adjusting the parameter values of at least two size parameters of the text according to the first font size and the second font size includes: adjusting the parameter value of the font size parameter to the first font size; and obtaining the scaling ratio of the second font size relative to the first font size; adjusting the parameter value of the character scaling ratio parameter according to the scaling ratio.
[0008] Optionally, the parameter value of the character zoom ratio parameter is one of a plurality of preset parameter values; adjusting the parameter value of the character zoom ratio parameter according to the zoom ratio includes: determining a target preset parameter value corresponding to the target ratio according to a target ratio and a preset mapping table; wherein the plurality of preset ratios include the target ratio; adjusting the parameter value of the character zoom ratio parameter to the target preset parameter value, and the mapping table includes a mapping relationship between the plurality of preset ratios and the plurality of preset parameter values.
[0009] Optionally, at least two size parameters include a first size of a character primitive of the text in a first direction and a second size in a second direction; adjusting parameter values of at least two size parameters of the text according to the first font size and the second font size includes: adjusting the first size to the size of the first font size; and obtaining a target ratio of the size of the second font size to the size of the first font size; and taking the product of the size of the second font size and the target ratio as the second size.
[0010] Optionally, obtaining a target ratio of the size of the second font size to the size of the first font size includes: obtaining a first pound value corresponding to the first font size and a second pound value corresponding to the second font size; and using the ratio of the second pound value to the first pound value as the target ratio.
[0011] Optionally, adjusting the size of the text according to the font size information includes: when the first font size and the second font size are the same, adjusting the parameter value of the font size parameter of the text to the first font size; and adjusting the size of the text according to the adjusted parameter value.
[0012] Optionally, before obtaining the font size information set for the text, the method also includes: displaying a first input window and a second input window in a preset interface; obtaining the font size information set for the text, including: obtaining the font size from the first input window as the first font size, and the font size from the second input window as the second font size.
[0013] Optionally, the first direction is horizontal and the second direction is vertical; or, the first direction is vertical and the second direction is horizontal.
[0014] According to a second aspect of the present disclosure, a text typesetting device is also provided, the device comprising: an acquisition module, used to acquire font size information set for characters in the text; wherein the font size information comprises a first font size of the characters in a first direction and a second font size of the characters in a second direction; an adjustment module, used to adjust the size of the characters according to the font size information to obtain adjusted characters; wherein the size of the adjusted characters in the first direction matches the first font size, and the size in the second direction matches the second font size.
[0015] Optionally, the adjustment module includes: a first parameter adjustment submodule, used to adjust the parameter values of at least two size parameters of the text according to the first font size and the second font size when the first font size is different from the second font size; and a size adjustment submodule, used to adjust the size of the text according to the adjusted parameter values.
[0016] Optionally, at least two size parameters include a font size parameter and a character scaling ratio parameter; the first parameter adjustment submodule includes: a font size adjustment unit, used to adjust the parameter value of the font size parameter to the first font size; and an acquisition unit, used to obtain the scaling ratio of the second font size relative to the first font size; a first scaling unit, used to adjust the parameter value of the character scaling ratio parameter according to the scaling ratio.
[0017] Optionally, the parameter value of the character scaling ratio parameter is one of a plurality of preset parameter values; the first size adjustment submodule is configured to determine a target preset parameter value corresponding to the target ratio according to the target ratio and a preset mapping table; wherein the plurality of preset ratios include the target ratio; the parameter value of the character scaling ratio parameter is adjusted to be the target preset parameter value, and the mapping table includes a mapping relationship between the plurality of preset ratios and the plurality of preset parameter values.
[0018] Optionally, at least two size parameters include a first size of a character primitive of the text in a first direction and a second size in a second direction; a first parameter adjustment submodule includes: a size adjustment unit, used to adjust the first size to the size of the first font size in the first direction; and an acquisition unit, used to acquire a target ratio of the size of the second font size to the size of the first font size; a second scaling unit, taking the product of the size of the second font size and the target ratio as the second size.
[0019] Optionally, the acquisition unit is used to acquire a first pound value corresponding to the first font size and a second pound value corresponding to the second font size; and use the ratio of the second pound value to the first pound value as the target ratio.
[0020] Optionally, the adjustment module includes: a second parameter adjustment submodule, used to adjust the parameter value of the font size parameter of the text to the first font size when the first font size and the second font size are the same; and a size adjustment submodule, used to adjust the size of the text according to the adjusted parameter value.
[0021] Optionally, the text typesetting device also includes: a display module, used to display a first input window and a second input window in a preset interface before the acquisition module acquires the font size information set for the text; an acquisition module, used to acquire the font size from the first input window as the first font size, and the font size from the second input window as the second font size.
[0022] Optionally, the first direction is horizontal and the second direction is vertical; or, the first direction is vertical and the second direction is horizontal.
[0023] According to a third aspect of the present disclosure, an electronic device is also provided, including a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the computer program to implement the method according to the first aspect of the present disclosure.
[0024] According to a fourth aspect of the present disclosure, a computer-readable storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, the method according to the first aspect of the present disclosure is implemented.
[0025] One beneficial effect of the disclosed embodiment is that the size of the text can be adjusted according to the first font size in the first direction and the second font size in the second direction set for the text, so that the size of the adjusted text in the first direction matches the first font size, and the size in the second direction matches the second font size, so as to solve the problem that the width or height of the text cannot be adjusted independently when adjusting the size of the text. The disclosed embodiment can adjust the size of the text in two directions to achieve the purpose of independently adjusting either the width or height of the text.
[0026] Other features and advantages of the embodiments of the present disclosure will become apparent from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the embodiments of the present disclosure.
[0028] Figure 1 is the value of the font size and its related parameters in the related art;
[0029] Figure 2 A method flow chart of a text typesetting method provided for some embodiments of the present disclosure;
[0030] Figure 3 A method flow chart of another text typesetting method provided for some embodiments of the present disclosure;
[0031] Figure 4 is a diagram of a character scaling ratio in the related art;
[0032] Figure 5 It is a diagram of setting character zoom ratio parameters in the related art;
[0033] Figure 6 A diagram showing a pop-up reminder message when a character zoom ratio parameter setting exceeds a parameter range in the related art;
[0034] Figure 7This is a diagram of a pop-up reminder message when the setting of the character zoom ratio parameter in the related art is invalid;
[0035] Fig. 8A A diagram of parameters of horizontal font size and vertical font size and text display results in a text typesetting method provided in some embodiments of the present disclosure;
[0036] Figure 8B Another illustration of parameters of horizontal font size and vertical font size and text display results in a text typesetting method provided in some embodiments of the present disclosure;
[0037] Fig. 9 is a block diagram of an electronic device according to some embodiments of the present disclosure;
[0038] Fig.10 It is a schematic diagram of the hardware structure of an electronic device according to some embodiments of the present disclosure. DETAILED DESCRIPTION
[0039] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.
[0040] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.
[0041] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0042] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0043] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0044] When typesetting text, you can set the size of the text by setting the font size of the text. Figure 1 As shown, there are two ways to measure font size, one is the number system, and the other is the point system (also known as the pound system).
[0045] In the case of the number system, the font size has multiple numbers, such as Figure 1There are 16 Chinese font sizes, which are arranged in descending order as follows: Chuhao, Xiaochu, Yihao, Xiaoyi, Erhao, Xiaoer, Sanhao, Xiaosan, Sihao, Xiaosi, Wuhao, Xiaowu, Liuhao, Xiaoliu, Qihao and Xiaoqi. In the point system, the font size has multiple pound values (unit: point / PT), and the multiple pound values can correspond to the above multiple numbers one by one. Figure 1 As shown, different font sizes correspond to different pixels (unit: px), and different font sizes correspond to different sizes (i.e., the size of the text). The larger the font size, the larger the pixels and size. Normally, since Chinese characters are square, the ratio of the height and width of the text is 1 when the text is Chinese, that is, the height and width of the text are equal. In this case, the height and width of the text can be uniformly referred to as the size of the text. When the font size of the text changes without changing the font of the text, the size of the text changes, that is, the width and height of the text both change.
[0046] In actual situations, based on actual typesetting needs, users may only want to modify one of the text width and height. For example, they may want to change the text width without changing the text height, or change the text height without changing the text width. Currently, since both the text width and height are changed after setting the font size, the above needs of users are difficult to meet.
[0047] Based on the above-mentioned problems, the embodiments of the present disclosure provide a new technical solution for text typesetting to solve the problem that when adjusting the size of characters in a text, the width or height of the characters cannot be adjusted independently.
[0048] Hereinafter, various embodiments and examples according to the present disclosure are described with reference to the drawings.
[0049] <Method Example>
[0050] Figure 2 A method flow chart of a text typesetting method provided by an embodiment of the present disclosure. Figure 2 As shown, the method includes the following steps S210 to S220.
[0051] Step S210: Obtain font size information set for characters in the text; wherein the font size information includes a first font size of the characters in a first direction and a second font size of the characters in a second direction.
[0052] For example, the first font size is Figure 1 Any of the 16 numbers or point sizes shown, the second size is as follows Figure 1 Any of the 16 numbers or point sizes shown. The first font size and the second font size can be the same or different.
[0053] To set the font size information, for example, the user may set the first font size and the second font size in the preset interface according to actual needs.
[0054] For example, before executing step S210, the embodiment of the present disclosure may display a first input window (such as Fig. 8A and Figure 8B The horizontal font size input window 61 shown in the figure) and the second input window (such as Fig. 8A and Figure 8B The vertical font size input window 62 is shown, and the user inputs the font size into the first input window and the second input window respectively according to actual needs. In this case, the embodiment of the present disclosure can obtain the font size from the first input window as the first font size, and obtain the font size from the second input window as the second font size.
[0055] The first direction is different from the second direction. For example, the first direction is horizontal and the second direction is vertical; or in another example, the first direction is vertical and the second direction is horizontal.
[0056] Step S220: adjusting the size of the text according to the font size information to obtain adjusted text; wherein the size of the adjusted text in the first direction matches the first font size, and the size of the adjusted text in the second direction matches the second font size.
[0057] The size of the adjusted text in the first direction matches the first font size, for example: the size of the adjusted text in the first direction is the size of the first font size.
[0058] For example, when the first direction is horizontal, the horizontal size of the adjusted text is the size of the first font size; for another example, when the first direction is vertical, the vertical size of the adjusted text is the size of the first font size.
[0059] The size of the adjusted text in the second direction matches the second font size, for example: the size of the adjusted text in the second direction is the size of the second font size.
[0060] For example, when the second direction is horizontal, the horizontal size of the adjusted text is the size of the second font size; for another example, when the second direction is vertical, the vertical size of the adjusted text is the size of the second font size.
[0061] When the first and second font sizes are different, such as Figure 3 As shown, the execution process of adjusting the size of the text according to the font size information in step S220 may include the following steps S310 to S320.
[0062] Step S310: adjusting parameter values of at least two size parameters of the text according to the first font size and the second font size.
[0063] In some embodiments, the at least two size parameters include a font size parameter and a character scaling ratio parameter.
[0064] The font size parameter is used to indicate the font size of the text. For more information about the font size, see Figure 1 The corresponding description about the font size in the above embodiments will not be repeated here.
[0065] The character scaling ratio parameter is used to indicate the character scaling ratio of the text. Specifically, the character scaling ratio is the ratio of the total length of the text in the horizontal direction to the standard total length of the text under standard conditions, when the font size in the text remains unchanged. In the standard condition, the length and width of the characters in the text are the same.
[0066] For example, Figure 4 As shown, the content of the text is "test software". The standard text of this text in the standard case is as follows Figure 4 As shown in the bottom line of the effect diagram, the width and height of the characters in the standard text are both h. In the horizontal direction, the total length of the standard text is the standard total length w. In the vertical direction, the length of the standard text is h.
[0067] For example, Figure 4 As shown, when the character scaling ratio is 80%, the total length of the text in the horizontal direction is 0.8w, and the ratio of the total length of the text to the standard total length w is 0.8, that is, 80%. In the vertical direction, the length of the text is h, which is the same as the length of the standard text in the vertical direction.
[0068] For example, Figure 4 As shown, when the character scaling ratio is 100%, the total length of the text is w, and the ratio of the total length of the text to the standard total length w is 1, that is, 100%. In the vertical direction, the length of the text is h, which is the same as the length of the standard text in the vertical direction.
[0069] For example, Figure 4 As shown, when the character scaling ratio is 150%, the total length of the text is 1.5w, and the ratio of the total length of the text to the standard total length w is 1.5, that is, 150%. In the vertical direction, the length of the text is h, which is the same as the length of the standard text in the vertical direction.
[0070] For example, Figure 4 As shown, when the character zoom ratio is 200%, the total length of the text is 2w, and the ratio of the total length of the text to the standard total length w is 2, that is, 200%. In the vertical direction, the length of the text is h, which is the same as the length of the standard text in the vertical direction.
[0071] In some examples, in step S310 , the font size parameter may be adjusted to the first font size, and the parameter value of the character scaling ratio parameter (ie, the character scaling ratio) may be adjusted according to the scaling ratio.
[0072] The character zoom ratio parameter has multiple preset parameter values, and the user can select a preset parameter value from the multiple preset parameter values as the parameter value of the character zoom ratio parameter according to his / her needs. The multiple preset parameter values (unit: %) can be any integer from 1 to 600. For example, the multiple preset parameter values can be 33, 50, 66, 80, 90, 100, etc.
[0073] For example, the user selects 100 from a plurality of preset parameter values as the parameter value of the preset parameter value. In this case, Figure 5 As shown, the character zoom ratio set by the user is 100 (see Figure 5 (the content in the dashed box).
[0074] When adjusting the parameter value of the character zoom ratio parameter according to the zoom ratio, a mapping table may be pre-set, the mapping table including a mapping relationship between a plurality of preset ratios and a plurality of preset parameter values, wherein the plurality of preset ratios include a target ratio. In this case, the preset parameter value corresponding to the target ratio may be determined as the target preset parameter value according to the target ratio and the mapping table, and then the parameter value of the character zoom ratio parameter may be adjusted to the target preset parameter value.
[0075] The mapping relationship between multiple preset ratios and multiple preset parameter values can be set by those skilled in the art according to actual conditions.
[0076] At present, Chinese office software all stores data based on Extensible Markup Language (XML), and the above-mentioned stored data includes the above-mentioned font size parameter and character scaling ratio parameter. In this case, the properties of the current Chinese office software include font size and character scaling ratio. For example, the font size and character scaling ratio of text can be set in both Word documents and WPS documents.
[0077] Based on the above description, it can be known that compared with the existing attributes of the current Chinese office software, no new attributes are added in the above-listed embodiments, but the font size and character scaling ratio in the existing attributes of the Chinese office software are converted by the internal algorithm (the size of the first font size is used as the font size, and the target ratio of the size of the second font size to the size of the first font size is used as the character scaling ratio) to achieve the effect of visually setting the width and / or height of the text. At the bottom level, for the Chinese office software that can implement the typesetting method of the text in the present disclosure, since the Chinese office software stores data based on XML, it can be compatible with other Chinese office software on the market in terms of data. In this case, other Chinese office software does not need to change the typesetting engine it uses (used to obtain text data and render it on the display screen of the display, so that the user can see the document page and the text located on the page on the display screen), and can also correctly display the content in the document, achieving the purpose of adjusting the size of the text in two directions. For example, for WPS software (WPS Office Software) that can implement the typesetting method of the text in the present disclosure, after editing the target document using the typesetting method of the text in the present disclosure, the size of the characters in the target document in the first direction is the size of the first font size, and the size of the characters in the target document in the second direction is the size of the second font size, and the target document is saved. After that, the target document can be directly opened using Word (Microsoft Office Word), and the characters in the target document can be correctly displayed in the opened target document, and the size of the characters in the first direction is the size of the first font size, and the size of the characters in the second direction is the size of the second font size.
[0078] In actual situations, Figure 6 As shown, the current preset parameter values of the character zoom ratio parameter range from 1 to 600. When the parameter value of the set character zoom ratio parameter is greater than 600, for example Figure 6 The parameter value of the character scaling ratio parameter is set to 1200. In this case, a prompt message will pop up to remind the user that the parameter value of the character scaling ratio parameter can only be selected within the range of 1 to 600, which greatly limits the range of text size adjustment; and the multiple preset parameter values that can be selected in the parameter value of the character scaling ratio parameter are all integers, and floating point numbers are not supported. For example, Figure 7 As shown, when you enter the floating point number 100.3 in the input box corresponding to the scaling column (see Figure 7 When the text is resized as shown in the dashed box, a prompt box pops up on the page, displaying the prompt message "Invalid measurement unit", which greatly limits the accuracy of text size adjustment.
[0079] In this case, in order to improve the above-mentioned problem of greatly limiting the adjustment range of text size and precision, in other embodiments, at least two size parameters include a first size of the text character primitive in the first direction and a second size in the second direction.
[0080] In this case, in step S310, the first size can be adjusted to the size of the first font size, and a target ratio of the second font size to the first font size is obtained, and the product of the second font size and the target ratio is used as the second size.
[0081] For example, the target ratio of the second font size to the first font size can be obtained by: obtaining a first pound value corresponding to the first font size and a second pound value corresponding to the second font size (when the first font size is a certain number, the target ratio can be obtained according to the following example: Figure 1 The corresponding relationship between the number and the pound value shown in the figure is used to determine the pound value corresponding to the number), and then the ratio of the second pound value to the first pound value is used as the target ratio. In this case, the target ratio can be expressed as a floating point number, so that the first size of the text in the first direction and the second size of the text in the second direction in the character primitive of the drawn text can be directly determined according to the target ratio expressed as a floating point number, so that the size adjustment result of the text is more accurate.
[0082] Step S320: adjusting the size of the text according to the adjusted parameter value.
[0083] In this step, the typesetting engine may be used to obtain the adjusted parameter value, so that the typesetting engine renders text having a size corresponding to the parameter value on the display screen according to the parameter value, and displays the text on the page of the document.
[0084] For example, the adjusted parameter values include a horizontal dimension in the horizontal direction and a vertical dimension in the vertical direction. The horizontal dimension of each character in the text is adjusted to the above horizontal dimension, and the vertical dimension of the character in the text is adjusted to the above vertical dimension. The area corresponding to the character is obtained, the color value of each pixel in the area is calculated (or whether each pixel in the area has color), and each pixel in the area is displayed in the area according to the calculation results, so that the pixels displayed in the area correspond to text that meets the adjusted size.
[0085] It can be seen that the embodiment of the present disclosure is able to adjust the size of text in two directions. Since the first direction and the second direction are different, and the first direction and the second direction are horizontal and vertical respectively, the embodiment of the present disclosure can achieve the purpose of independently adjusting either the width and height of the text, so as to meet the needs of users in actual typesetting to independently adjust either the width and height of the text.
[0086] In some embodiments, when the first font size and the second font size are the same, the disclosed embodiments may adjust the parameter value of the font size parameter of the text to the first font size, and then adjust the size of the text according to the adjusted parameter value.
[0087] The embodiments of the present disclosure are described below by means of several specific examples.
[0088] like Fig. 8A As shown, the display interface displays a horizontal font size input window 61 (i.e., the first input window) and a vertical font size input window 62 (i.e., the second input window). The font size set in the horizontal font size input window 61 is 36 points, and the font size set in the vertical font size input window 62 is 28 points. In this case, the horizontal size of the characters in the text is the size of 36 points, and the vertical size of the characters in the text is the size of 28 points.
[0089] like Figure 8B As shown, the height H1 of the characters in the text is smaller than the line height H2 of the line where the text is located. In order to make the characters fill the entire line, the horizontal font size of the characters can be unchanged (the horizontal font size of the characters is still 36 pounds), and the font size in the vertical font size input window 52 can be changed to 72 pounds to achieve the effect of making the characters fill the entire line.
[0090] <Equipment Embodiment>
[0091] Fig. 9 is a principle block diagram of a text typesetting device according to some embodiments of the present disclosure. Fig. 9 As shown, the text typesetting device 70 may include: an acquisition module 71 and an adjustment module 72 .
[0092] The acquisition module 71 is used to acquire the font size information set for the characters in the text; wherein the font size information includes a first font size of the characters in a first direction and a second font size of the characters in a second direction.
[0093] The adjustment module 72 is used to adjust the size of the text according to the font size information to obtain adjusted text; wherein the size of the adjusted text in the first direction matches the first font size, and the size in the second direction matches the second font size.
[0094] Optionally, the adjustment module includes: a first parameter adjustment submodule, used to adjust the parameter values of at least two size parameters of the text according to the first font size and the second font size when the first font size is different from the second font size; and a size adjustment submodule, used to adjust the size of the text according to the adjusted parameter values.
[0095] Optionally, at least two size parameters include a font size parameter and a character scaling ratio parameter; the first parameter adjustment submodule includes: a font size adjustment unit, used to adjust the parameter value of the font size parameter to the first font size; and an acquisition unit, used to obtain the scaling ratio of the second font size relative to the first font size; a first scaling unit, used to adjust the parameter value of the character scaling ratio parameter according to the scaling ratio.
[0096] Optionally, the parameter value of the character scaling ratio parameter is one of a plurality of preset parameter values; the first size adjustment submodule is configured to determine a target preset parameter value corresponding to the target ratio according to a target ratio and a preset mapping table; wherein the plurality of preset ratios include the target ratio, and the mapping table includes a mapping relationship between a plurality of preset ratios and the plurality of preset parameter values; and the parameter value of the character scaling ratio parameter is adjusted to be the target preset parameter value.
[0097] Optionally, at least two size parameters include a first size of a character primitive of the text in a first direction and a second size in a second direction; a first parameter adjustment submodule includes: a size adjustment unit, used to adjust the first size to the size of the first font size in the first direction; and an acquisition unit, used to acquire a target ratio of the size of the second font size to the size of the first font size; a second scaling unit, taking the product of the size of the second font size and the target ratio as the second size.
[0098] Optionally, the acquisition unit is used to acquire a first pound value corresponding to the first font size and a second pound value corresponding to the second font size; and use the ratio of the second pound value to the first pound value as the target ratio.
[0099] Optionally, the adjustment module includes: a second parameter adjustment submodule, used to adjust the parameter value of the font size parameter of the text to the first font size when the first font size and the second font size are the same; and a size adjustment submodule, used to adjust the size of the text according to the adjusted parameter value.
[0100] Optionally, the text typesetting device also includes: a display module, used to display a first input window and a second input window in a preset interface before the acquisition module acquires the font size information set for the text; an acquisition module, used to acquire the font size from the first input window as the first font size, and the font size from the second input window as the second font size.
[0101] Optionally, the first direction is horizontal and the second direction is vertical; or, the first direction is vertical and the second direction is horizontal.
[0102] Fig.10 is a schematic diagram of the hardware structure of an electronic device according to another embodiment.
[0103] like Fig.10As shown, the electronic device 800 includes a processor 801 and a memory 802, wherein the memory 802 is used to store an executable computer program, and the processor 801 is used to execute a method as any of the above method embodiments according to the control of the computer program.
[0104] The electronic device 800 may be a PC.
[0105] Each module of the above electronic device 800 may be implemented by the processor 801 in this embodiment executing a computer program stored in the memory 802 , or may be implemented by other circuit structures, which is not limited here.
[0106] The electronic device 800 may be a personal computer (PC).
[0107] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0108] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0109] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0110] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0111] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0112] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0113] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0114] The flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of an instruction, and the module, a program segment or a part of an instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that it is equivalent to implement it by hardware, implement it by software, and implement it by combining software and hardware.
[0115] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the marketplace, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein. The scope of the present disclosure is defined by the appended claims.
Claims
1. A text typesetting method, characterized in that: include: Obtaining font size information set for a character in a text; wherein the font size information includes a first font size of the character in a first direction and a second font size of the character in a second direction; Adjusting the size of the text according to the font size information to obtain adjusted text; wherein the size of the adjusted text in the first direction matches the first font size, and the size of the adjusted text in the second direction matches the second font size; Wherein, adjusting the size of the text according to the font size information includes: When the first font size is different from the second font size, adjusting the parameter values of at least two size parameters of the text according to the first font size and the second font size; Adjust the size of the text according to the adjusted parameter value; The at least two size parameters include a font size parameter and a character scaling ratio parameter, wherein the font size parameter and the character scaling ratio parameter are data stored based on extensible markup language, and the character scaling ratio is used to represent the ratio of the total length of the text in the horizontal direction to the standard total length of the text under standard conditions when the font size in the text remains unchanged, wherein the length and width of the characters in the text under standard conditions are the same; The step of adjusting the parameter values of at least two size parameters of the text according to the first font size and the second font size includes: Adjusting the parameter value of the font size parameter to the first font size; and, Obtaining a target ratio of the second font size to the first font size; The parameter value of the character zoom ratio parameter is adjusted according to the target ratio.
2. The method according to claim 1, characterized in that: The parameter value of the character scaling ratio parameter is one of a plurality of preset parameter values; The step of adjusting the parameter value of the character zoom ratio parameter according to the target ratio includes: Determine a target preset parameter value corresponding to the target ratio according to the target ratio and a preset mapping table; wherein the mapping table includes a mapping relationship between a plurality of preset ratios and the plurality of preset parameter values, and the plurality of preset ratios includes the target ratio; The parameter value of the character zoom ratio parameter is adjusted to be the target preset parameter value.
3. The method according to claim 1, characterized in that The adjusting the size of the text according to the font size information includes: When the first font size and the second font size are the same, adjusting the parameter value of the font size parameter of the text to the first font size; The size of the text is adjusted according to the adjusted parameter value.
4. The method according to claim 1, characterized in that: Before obtaining the font size information set for the characters in the text, the method further includes: Displaying a first input window and a second input window in a preset interface; The acquiring of the font size information set for the characters in the text includes: acquiring the font size from the first input window as the first font size, and acquiring the font size from the second input window as the second font size.
5. The method according to any one of claims 1 to 4, characterized in that: The first direction is horizontal, and the second direction is vertical; or, the first direction is vertical, and the second direction is horizontal.
6. A text typesetting device, characterized in that: include: An acquisition module, used for acquiring font size information set for characters in a text; wherein the font size information includes a first font size of the characters in a first direction and a second font size of the characters in a second direction; an adjustment module, configured to adjust the size of the text according to the font size information to obtain adjusted text; wherein the size of the adjusted text in the first direction matches the first font size, and the size of the adjusted text in the second direction matches the second font size; The adjustment module is specifically used for adjusting the parameter values of at least two size parameters of the text according to the first font size and the second font size when the first font size is different from the second font size; adjusting the size of the text according to the adjusted parameter values; the at least two size parameters include a font size parameter and a character scaling ratio parameter, the font size parameter and the character scaling ratio parameter are data stored based on extensible markup language, the character scaling ratio is used to represent the ratio of the total length of the text in the horizontal direction to the standard total length of the text under standard conditions when the font size in the text remains unchanged, wherein the length and width of the characters in the text under standard conditions are the same; The adjustment module is specifically used to adjust the parameter value of the font size parameter to the first font size; obtain a target ratio between the size of the second font size and the size of the first font size; and adjust the parameter value of the character scaling ratio parameter according to the target ratio.
7. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the computer program to implement the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements the method according to any one of claims 1 to 5.