Line height determination method and device, electronic equipment and storage medium
By constructing virtual fonts and node attribute metrics, the line height of embedded shapes is calculated, solving the problem of inaccurate line height calculation for embedded shapes and achieving more precise typesetting effects.
Patent Information
- Application Number
- CN202411124585.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2026-03-03
AI Technical Summary
In existing technologies, the accuracy of line height calculation for embedded shapes within a line is insufficient, especially when setting single or multiple line spacing, leading to visual disharmony or layout errors.
By treating the embedded shape as a text processing, virtual font metrics and virtual node attribute metrics are constructed, the first top distance and bottom distance are extracted, and the line height is calculated by combining the text height information. The baseline position is then adjusted to improve accuracy.
It improves the accuracy of line height determination, ensures a consistent processing logic when text and images are mixed, and improves the layout effect.
Smart Images

Figure CN121598891A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and storage medium for determining row height. Background Technology
[0002] Embedded shapes are common elements in document processing. In related technologies, the height of the embedded shape is simply used to calculate its position in the line. For example, if the height of the embedded shape is 2cm and the line spacing is 1.5, then the line height corresponding to the embedded shape is 2cm * 1.5 = 3cm. However, the accuracy of the line height obtained in this way needs to be improved. Summary of the Invention
[0003] The following is an overview of the subject matter described in detail in this disclosure. This overview is not intended to limit the scope of the claims.
[0004] This disclosure provides a method for determining line height, a model training method, and an apparatus. By treating the embedded shape as a text when calculating its line height, a unified processing logic is achieved in mixed text and image layouts, thereby effectively improving the accuracy of line height determination.
[0005] On one hand, embodiments of this disclosure provide a method for determining row height, including:
[0006] Read the virtual font measurement of the embedded shape and the virtual node attribute measurement of the embedded shape, wherein the virtual node attribute measurement is constructed on the basis of the original node attribute measurement of the target node, the target node is the node to which the embedded shape belongs in the document object model tree, and the virtual font measurement is constructed on the basis of the original shape measurement of the embedded shape.
[0007] The first top distance and the first bottom distance of the embedded shape are extracted from the virtual font metric, and the text height information is extracted from the virtual node attribute metric.
[0008] The shape height of the embedded shape is determined based on the first top distance and the first bottom distance, and the virtual text height corresponding to the embedded shape is determined based on the text height information.
[0009] The target row height corresponding to the embedded shape is determined based on the shape height and the virtual text height.
[0010] On the other hand, embodiments of this disclosure also provide a row height determination device, including:
[0011] The first processing module is used to read the virtual font measurement of the embedded shape and the virtual node attribute measurement of the embedded shape. The virtual node attribute measurement is constructed on the basis of the original node attribute measurement of the target node. The target node is the node to which the embedded shape belongs in the document object model tree. The virtual font measurement is constructed on the basis of the original shape measurement of the embedded shape.
[0012] The second processing module is used to extract the first top distance and the first bottom distance of the embedded shape from the virtual font metric, and to extract the text height information from the virtual node attribute metric.
[0013] The third processing module is used to determine the shape height of the embedded shape based on the first top distance and the first bottom distance, and to determine the virtual text height corresponding to the embedded shape based on the text height information.
[0014] The fourth processing module is used to determine the target row height corresponding to the embedded shape based on the shape height and the virtual text height.
[0015] Furthermore, in determining the target row height corresponding to the embedded shape based on the shape height and the virtual text height, the fourth processing module is also used for:
[0016] When the embedded shape is configured with an underline, determine the height increment generated by the underline;
[0017] The target row height corresponding to the embedded shape is determined based on the shape height, the virtual text height, and the height increment.
[0018] Furthermore, in determining the target row height corresponding to the embedded shape based on the shape height, the virtual text height, and the height increment, the fourth processing module is also used for:
[0019] Determine the row spacing multiple of the embedded shape, and determine an adjustment coefficient based on the difference between the row spacing multiple and the unit multiple;
[0020] The adjusted virtual text height is obtained by multiplying the adjustment coefficient by the virtual text height.
[0021] The target row height corresponding to the embedded shape is obtained by summing the shape height, the adjusted virtual text height, and the height increment.
[0022] Furthermore, the virtual node attribute measurement includes virtual running attribute measurement, and the fourth processing module is further used to determine the height increment generated by the underscore:
[0023] The first baseline position of the embedded shape is extracted from the virtual font metric, and the corresponding second bottom distance and second baseline position are determined based on the text height information in the virtual running attribute metric.
[0024] Adjust the first bottom distance or the second bottom distance so that the first baseline position is aligned with the second baseline position, and obtain the height increment generated by the underline based on the difference between the adjusted second bottom distance and the first bottom distance.
[0025] Furthermore, the text height information is text size information. The fourth processing module is further configured to: determine the corresponding second bottom distance and second baseline position based on the text height information in the virtual running attribute metric.
[0026] The text size information in the virtual running attribute measurement is used as the input parameter of the surveying interface function, and the surveying interface function is called.
[0027] The mapping interface function returns the corresponding second bottom distance and second baseline position.
[0028] Furthermore, the fourth processing module is also used to adjust the first bottom distance or the second bottom distance to align the first baseline position with the second baseline position, and to further:
[0029] Determine a first positional difference between the first baseline position and the second baseline position;
[0030] Adjust the first bottom distance or the second bottom distance according to the first position difference so that the first baseline position is aligned with the second baseline position.
[0031] Furthermore, the virtual node attribute measurement includes virtual running attribute measurement and virtual paragraph attribute measurement. The second processing module is further used to extract text height information from the virtual node attribute measurement:
[0032] Obtain version compatibility information for the document that carries the embedded shape;
[0033] The text height information is extracted from the virtual runtime attribute metric or the virtual paragraph attribute metric based on the version compatibility information.
[0034] Furthermore, the second processing module is further configured to: extract text height information from the virtual runtime attribute metric or the virtual paragraph attribute metric based on the version compatibility information;
[0035] When the version compatibility information indicates that the document is compatible with versions within a historical time period, the text height information is extracted from the virtual running attribute metric.
[0036] When the version compatibility information indicates that the document is compatible with versions outside the historical time period, the text height information is extracted from the virtual paragraph attribute metric.
[0037] Furthermore, before reading the virtual font metric of the embedded shape and the virtual node attribute metric of the embedded shape, the first processing module is also used to:
[0038] Obtain the shape height, and determine the first top distance and the first bottom distance based on the shape height;
[0039] The virtual font metric is constructed based on the first top distance and the first bottom distance;
[0040] The text size information is obtained from the original node attribute measurement of the target node, and the virtual node attribute measurement is constructed based on the text size information.
[0041] Furthermore, in constructing the virtual font metric based on the first top distance and the first bottom distance, the first processing module is also used for:
[0042] Obtain the first baseline position of the embedded shape;
[0043] The virtual font metric is constructed based on the first baseline position, the first top distance, and the first bottom distance.
[0044] Furthermore, in constructing the virtual node attribute metric based on the text size information, the first processing module is also used for:
[0045] The text size information is used as the input parameter of the surveying interface function, and the surveying interface function is called.
[0046] The virtual node attribute metric is constructed based on the second top distance, second bottom distance, and second baseline position returned by the mapping interface function.
[0047] Furthermore, in determining the first top distance and the first bottom distance based on the shape height, the first processing module is also used for:
[0048] Determine the alignment method configured for the embedded shape, and determine the first baseline position of the embedded shape based on the alignment method;
[0049] The first top distance and the first bottom distance are determined based on the first baseline position and the shape height.
[0050] Furthermore, the fourth processing module is also used for:
[0051] The first baseline position of the embedded shape is extracted from the virtual font metric, and the offset of the embedded shape relative to the row is determined based on the first baseline position and the target row height.
[0052] The embedded shape is drawn based on the offset.
[0053] On the other hand, embodiments of this disclosure also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described row height determination method or model training method.
[0054] On the other hand, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program, which is executed by a processor to implement the above-described row height determination method or model training method.
[0055] On the other hand, this disclosure also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the row height determination method or model training method described above.
[0056] The embodiments disclosed herein include at least the following beneficial effects: By reading the virtual font measurement and the virtual node attribute measurement of the embedded shape, since the virtual node attribute measurement is additionally constructed on the basis of the original node attribute measurement of the target node, and the target node is the node to which the embedded shape belongs in the document object model tree, and the virtual font measurement is additionally constructed on the basis of the original shape measurement of the embedded shape, it is equivalent to treating the embedded shape as a virtual text, and the virtual font measurement and the virtual node attribute measurement form the complete attributes of this virtual text. On this basis, the first top distance and the first bottom distance of the embedded shape are extracted from the virtual font measurement, and the text height information is extracted from the virtual node attribute measurement. The shape height of the embedded shape is determined according to the first top distance and the first bottom distance, and the virtual text height corresponding to the embedded shape is determined according to the text height information. The target line height corresponding to the embedded shape is determined according to the shape height and the virtual text height. Thus, the embedded shape can be treated as a text when calculating the line height of the embedded shape, realizing a unified processing logic in the case of mixed text and graphics, and effectively improving the accuracy of line height determination.
[0057] Other features and advantages of this disclosure will be set forth in the following description and will be apparent in part from the description or may be learned by practicing this disclosure. Attached Figure Description
[0058] The accompanying drawings are provided to further understand the technical solutions of this disclosure and constitute a part of the specification. They are used together with the embodiments of this disclosure to explain the technical solutions of this disclosure and do not constitute a limitation on the technical solutions of this disclosure.
[0059] Figure 1 This is an optional schematic diagram for displaying row height using existing technology;
[0060] Figure 2 A schematic diagram illustrating an optional implementation environment provided for an embodiment of this disclosure;
[0061] Figure 3 An optional flowchart of the row height determination method provided in the embodiments of this disclosure;
[0062] Figure 4 This is an optional schematic diagram illustrating the embedding of typed content into a document, as provided in an embodiment of this disclosure.
[0063] Figure 5 This is an optional schematic diagram for visualizing the virtual font metric structure disclosed in this embodiment;
[0064] Figure 6This is an optional schematic diagram illustrating the construction of virtual font metrics and virtual node attribute metrics provided in an embodiment of this disclosure;
[0065] Figure 7 An optional schematic flowchart illustrating the height increment and text height information acquisition rules provided in this embodiment of the disclosure;
[0066] Figure 8 This is an optional schematic diagram of a text mapping structure constructed based on virtual running attribute measurement, provided in an embodiment of this disclosure.
[0067] Figure 9 A schematic diagram of an optional flowchart for calculating the target row height provided in an embodiment of this disclosure;
[0068] Figure 10 An optional schematic diagram illustrating the alignment of a first baseline position with a second baseline position, provided for an embodiment of this disclosure;
[0069] Figure 11 An optional schematic diagram illustrating the configuration of a first baseline position provided in an embodiment of this disclosure;
[0070] Figure 12 This is an optional schematic diagram illustrating the adjustment of the embedded shape position according to an embodiment of the present disclosure;
[0071] Figure 13 This is a schematic diagram of an optional overall process for determining row height provided in an embodiment of the present disclosure;
[0072] Figure 14 A schematic diagram of the structure of the row height determination device is provided for embodiments of this disclosure;
[0073] Figure 15 This is a partial structural block diagram of a terminal provided in an embodiment of the present disclosure;
[0074] Figure 16 This is a partial structural block diagram of a server provided in an embodiment of this disclosure. Detailed Implementation
[0075] To make the objectives, technical solutions, and advantages of this disclosure clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the scope of this disclosure.
[0076] It should be noted that in the various specific embodiments of this disclosure, when processing is required based on data related to the characteristics of the target object, such as target object attribute information or a set of attribute information, the permission or consent of the target object will be obtained first. Furthermore, the collection, use, and processing of this data will comply with relevant laws, regulations, and standards. The target object can be a user. In addition, when embodiments of this disclosure require obtaining target object attribute information, separate permission or consent from the target object will be obtained through pop-ups or redirection to a confirmation page. Only after obtaining the target object's separate permission or consent will the necessary target object-related data for the normal operation of the embodiments of this disclosure be obtained.
[0077] In this disclosure, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0078] To facilitate understanding of the technical solutions provided in the embodiments of this disclosure, some key terms used in the embodiments of this disclosure will be explained below:
[0079] Document Object Model Tree (DOM): Organizes the elements in a document into a tree structure according to their hierarchical relationship. In this tree structure, each node represents an element, attribute, or text content in the document. The DOM can be used to add, delete, and modify the content and structure of the document, thereby realizing dynamic content updates and user interaction.
[0080] Elements: These are the basic building blocks of a page. Elements are interconnected through parent-child relationships, sibling relationships, etc., and multiple elements together define the structure and content of the document.
[0081] Embedding: Used to describe the state in which an element is integrated or merged into another larger structure.
[0082] Baseline: In font design, a baseline is used to align characters; it is an imaginary line. In document layout, baseline alignment ensures the continuity and readability of document content.
[0083] Line spacing: refers to the vertical spacing between lines, used to adjust the distribution and layout of text or other content in a paragraph. Different languages and fonts have different methods for calculating line spacing.
[0084] Font metrics are a structure used for text mapping that includes a series of parameters required for font rendering, such as maximum rise height, maximum fall height, baseline, and underline display position. These parameters ensure the consistency and readability of document content across different devices and environments.
[0085] Paragraph properties metrics: In the current document, there are multiple paragraphs, and each paragraph has its corresponding paragraph properties metrics. Paragraph properties metrics refer to parameters used to describe and control the paragraph layout, such as text size information, line spacing, paragraph alignment, etc. Text size information refers to parameters that can affect text size, such as font, font size, etc.
[0086] Run properties metrics: Each paragraph of text has its own corresponding run properties metrics. Run properties metrics are parameters used to describe and control the text layout, such as text size information, whether there are underlines, etc.
[0087] Embedded shapes are common elements in document processing, and their placement within a document is particularly important. When inserting an embedded shape, the common approach is to simply calculate its position within the line using its height and the currently set line spacing, thus adjusting the line height of the line containing the embedded shape. However, this method can be problematic when attempting to adjust the layout of embedded shapes by changing line spacing, especially with single or multiple line spacing. In such cases, the actual line height of the embedded shape's line may differ from the expected line height calculated based on the line spacing multiple, leading to visual disharmony or layout errors. (See reference...) Figure 1 , Figure 1 This is an illustration of an alternative method for displaying row height using existing techniques. Figure 1 The row spacing is set to 1.5 times the line spacing, and the height of the ellipse is 3. According to the above formula, the row spacing is calculated to be 4.5, but the actual row height is 10. The row height of the row containing the ellipse is not 1.5 times the height of the graphic.
[0088] Based on this, embodiments of this disclosure provide a method, apparatus, electronic device, and storage medium for determining line height, which can treat the embedded shape as a text when calculating the line height of the embedded shape, realize unified processing logic when text and graphics are mixed, and effectively improve the accuracy of line height determination.
[0089] Reference Figure 2 , Figure 2This is a schematic diagram of an optional implementation environment provided by an embodiment of the present disclosure, the implementation environment including a terminal 201.
[0090] For example, in terminal 201, the virtual font measurement and virtual node attribute measurement of the embedded shape are read. The first top distance and the first bottom distance of the embedded shape are extracted from the virtual font measurement. Text height information is extracted from the virtual paragraph attribute measurement or the virtual run attribute measurement in the virtual node attribute measurement. The shape height of the embedded shape is determined based on the first top distance and the first bottom distance. The virtual text height corresponding to the embedded shape is determined based on the text height information. The target line height corresponding to the embedded shape is determined based on the shape height and the virtual text height. After calculating the target line height, the embedded shape is typeset based on the target line height.
[0091] It is understandable that the process of determining the row height described above can also be performed on the server. After the server completes the calculation of the target row height, it sends the target row height information to the terminal 201. The terminal 201 then typesets the embedded shape based on the target row height.
[0092] A server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Additionally, a server can also be a node server in a blockchain network.
[0093] Terminal 201 can be a mobile phone, computer, smart voice interaction device, smart home appliance, vehicle terminal, etc., but is not limited to these. Terminal 201 and server can be directly or indirectly connected through wired or wireless communication, and this disclosure embodiment does not impose any limitations.
[0094] The methods provided in this disclosure can be applied to different scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving.
[0095] Reference Figure 3 , Figure 3 This is an optional flowchart of a row height determination method provided in an embodiment of the present disclosure. The row height determination method can be executed by a terminal, or by a server, or by a combination of a server and a terminal. The row height determination method includes, but is not limited to, the following steps S301 to S304.
[0096] Step S301: Read the virtual font measurement of the embedded shape and the virtual node attribute measurement of the embedded shape.
[0097] Among them, embedded shapes refer to the shapes of embedded typographic content. These can be regular shapes with clear and fixed geometric properties, such as rectangles, circles, triangles, trapezoids, etc. (Refer to...) Figure 4 , Figure 4 This is an optional schematic diagram illustrating the embedding of typesetting content into a document according to an embodiment of this disclosure. The typesetting content embedded in the document is an image, and the embedded shape of the image is a rectangle; it can also be an irregular shape without fixed geometric properties or with blurred boundaries, such as a curve, the outline of a entity instance, irregular line segments, etc. The outline of an entity instance includes the outline drawing of things that can be realistically touched in nature, such as the outline of a tree, the outline of a rabbit in static form, the outline of clothing, etc. Virtual font measurement is a fictitious measurement used to describe the embedded shape from the perspective of text mapping. It is constructed on the basis of the original shape measurement of the embedded shape, equivalent to the font measurement of a certain character. Font measurement is a parameter used to describe the character, such as including the first baseline position, the first top distance, the first bottom distance, etc. The original shape measurement of the embedded shape is a parameter used to describe the embedded shape, including the width, height, proportional scaling ratio in the document, vertical stretching ratio, etc. of the embedded shape. Virtual node attribute measurement is a fictitious measurement used to describe node attributes from the perspective of text mapping. It is constructed on the basis of the original node attribute measurement of the target node. In addition to this, virtual paragraph attribute metrics and virtual runtime attribute metrics are constructed. Virtual paragraph attribute metrics are fictitious paragraph attribute metrics, and virtual runtime attribute metrics are fictitious runtime attribute metrics. The target node is the node to which the embedded shape belongs in the Document Object Model (DOM) tree. It can be a paragraph node or a runtime node. Node attribute metrics are parameters used to describe the attributes of nodes in the DOM tree. Node attribute metrics can be paragraph attribute metrics or runtime attribute metrics. In the DOM tree, the paragraph node is the parent node of the runtime node. For embedded shapes, the paragraph attribute metrics of the paragraph node, the runtime attribute metrics of the runtime node, and the shape metrics are nested sequentially. For ordinary text, the paragraph attribute metrics of the paragraph node, the runtime attribute metrics of the runtime node, and the font metrics are nested sequentially.
[0098] In one possible implementation, before reading the virtual font measurement and the virtual node attribute measurement of the embedded shape, it is necessary to first construct the virtual font measurement based on the original shape measurement of the embedded shape, and then construct the virtual node attribute measurement based on the original node attribute measurement. Specifically, this can be done by obtaining the shape height, determining the first top distance and the first bottom distance based on the shape height, constructing the virtual font measurement based on the first top distance and the first bottom distance, obtaining the text size information from the original node attribute measurement of the target node, and constructing the virtual node attribute measurement based on the text size information.
[0099] Specifically, when the target node is a paragraph node, text size information can be obtained from the original paragraph attribute measure of the target node; or, when the target node is a runtime node, text size information can be obtained from the original runtime attribute measure of the target node. A virtual paragraph attribute measure is constructed based on the paragraph attribute measure, and a virtual runtime attribute measure is constructed based on the runtime attribute measure. Next, when inserting an embedded shape into the document, the proportional scaling ratio or vertical stretching ratio of the embedded shape is first determined. The current shape height of the embedded shape is determined based on its original shape height and the proportional scaling ratio, or based on its original shape height and the vertical stretching ratio. A first top distance and a first bottom distance are determined based on the obtained current shape height, and a virtual font measure is constructed based on the first top distance and the first bottom distance.
[0100] By constructing virtual font metrics and virtual node attribute metrics, the geometric parameters of embedded shapes are transformed into the same text mapping format as the text parameters. This transformation process ensures data format consistency, enabling a unified mapping perspective to understand the relationship between embedded shapes and text. Using the same data benchmark when calculating the target line height avoids computational obstacles caused by parameter format differences, thereby improving the accuracy and reliability of line height calculation.
[0101] In one possible implementation, the process of constructing the virtual font metric based on the first top distance and the first bottom distance can specifically involve obtaining the first baseline position of the embedded shape, and constructing the virtual font metric based on the first baseline position, the first top distance, and the first bottom distance. The first baseline position is located between the upper and lower boundaries of the embedded shape, or it can coincide with either the upper or lower boundary of the embedded shape. The first baseline position is used to align the embedded shape with the text border of the text in the paragraph containing the embedded shape.
[0102] Specifically, the height of the currently displayed embedded shape can be calculated based on a proportional scaling ratio or a vertical stretching ratio. The alignment method configured for the embedded shape is then obtained. Based on the alignment method, a first baseline position is configured within the area where the embedded shape is located. This first baseline position is then vertically shifted upwards or downwards to the upper or lower boundary of the embedded shape. The distance between the first baseline position and the upper boundary is taken as the first top distance, and the distance between the first baseline position and the lower boundary is taken as the first bottom distance. A virtual font metric is then constructed based on the first baseline position, the first top distance, and the first bottom distance. (Refer to...) Figure 5 , Figure 5 This is an optional schematic diagram illustrating the visualization of the virtual font metric structure disclosed in this embodiment. The layout content is an image with a width of 10 and a height of 6. The embedded shape of the image is a rectangle, represented by a gray rectangular area. The embedded shape has a width of 10 and a height of 6. A horizontal median line is formed by connecting the midpoint of the left boundary and the midpoint of the right boundary of the embedded shape. The median line is set as the first baseline position. The first top distance, determined based on the distance between the first baseline position and the upper boundary, is 3. The first bottom distance, determined based on the distance between the first baseline position and the lower boundary, is also 3. The virtual font metric of the embedded shape can be represented as {first baseline position: horizontal median line, first top distance: 3, first bottom distance: 3}.
[0103] By introducing a first baseline position when constructing the virtual font metric, the data processing efficiency can be effectively improved by quickly reading the first baseline position from the virtual font metric when it is needed.
[0104] In one possible implementation, during the process of constructing virtual node attribute metrics based on text size information, the text size information can be used as an input parameter of a surveying interface function. The surveying interface function is called, and the corresponding second top distance, second bottom distance, and second baseline position are returned by the surveying interface function. The virtual node attribute metrics are then constructed based on the second top distance, second bottom distance, and second baseline position. Specifically, when the constructed virtual node attribute metric is a virtual runtime attribute metric, the paragraph alignment is obtained from the original paragraph attribute metric. The mapping interface function is then called, using the paragraph alignment, font, and font size extracted from the original runtime attribute metric as input parameters. This data is passed to the document's backend server. The backend server obtains the second baseline position using the paragraph alignment. Next, the font rendering engine is enabled to obtain the width and height of the text borders for the specific font and font size. Based on the second baseline position, the text border height, and the top and bottom boundaries of the text borders, the second top distance and second bottom distance corresponding to the text borders are obtained. The second top distance, second bottom distance, and second baseline position are returned through the mapping interface function. The virtual runtime attribute metric is then constructed based on these parameters. Alternatively, only the font and font size from the original runtime attribute metric can be used as input parameters to the mapping interface function, and the backend server can directly read the current paragraph alignment and return it through the mapping interface function.
[0105] When the constructed virtual node attribute metric is a virtual paragraph attribute metric, the paragraph alignment, paragraph font, and paragraph font size are obtained from the paragraph attribute metric. A surveying interface function is then called, and based on the second top distance, second bottom distance, and second baseline position returned by the surveying interface function, the virtual paragraph attribute metric is constructed. The process of returning data by calling the surveying interface function is consistent with the process of constructing the virtual running attribute metric described above, and will not be repeated here.
[0106] Since the data processing logic of the surveying interface function is encapsulated, the process of obtaining data can be simplified by calling the surveying interface function. In addition, the surveying interface function supports a variety of security mechanisms, which can protect the transmitted data from unauthorized access or tampering, thereby enhancing the reliability of the data.
[0107] In addition, virtual node attribute metrics can be directly constructed based on text size information. Subsequently, when determining the virtual text height, the virtual text height can be called using the aforementioned method based on the text size information to obtain the second top distance and the second bottom distance.
[0108] Reference Figure 6 , Figure 6This is an optional schematic diagram illustrating the construction of virtual font metrics and virtual node attribute metrics provided in this embodiment of the disclosure. The original paragraph attribute metrics include the paragraph's font, font size, line spacing, and paragraph alignment. The original runtime attribute metrics include the font, font size, and underline status (TRUE indicates an underline is configured). The original shape metrics include width, height, proportional scaling ratio, and vertical stretching ratio. Virtual paragraph attribute metrics are constructed based on the font, font size, and alignment in the paragraph node. The second baseline position is determined based on the paragraph alignment. The second top distance is determined based on the font, font size, and the position of the second baseline. and the second bottom distance Virtual runtime attribute metrics are constructed based on the font, font size, paragraph alignment, and underline status in the runtime nodes, and the position of the second baseline is determined based on the paragraph alignment. The second top distance is determined based on the font, font size, and the position of the second baseline. and the second bottom distance When the underscore value is TRUE, get the underscore position p. spacing A virtual font metric is constructed based on the height element and the proportional scaling ratio, or the height element and the vertical stretching ratio, in the shape metric node. The shape height after proportional scaling or vertical stretching is determined. The first baseline distance is determined based on the alignment configured for the embedded shape. And the shape height determines the distance to the first top. and the first bottom distance
[0109] It should also be noted that virtual paragraph attribute metrics, virtual runtime attribute metrics, and virtual font metrics are three relatively independent yet interconnected metrics. Subsequent line height calculations can be based on one or more of these metrics. Unlike paragraph attribute metrics, runtime attribute metrics, and font metrics, virtual paragraph attribute metrics, virtual runtime attribute metrics, and virtual font metrics do not necessarily have a nested relationship. These three types of metrics are integrated into a single set of data. This set of data describes the embedding state of any embedded shape within the document. The virtual font metric describes the font derived from the geometric information of the embedded shape. The virtual paragraph attribute metric focuses on describing the overall characteristics of the paragraph containing the embedded shape. The virtual runtime attribute metric delves into the text level within the paragraph containing the embedded shape, focusing on text or text borders adjacent to or related to the embedded shape. By adjusting these metrics, precise control over document layout can be achieved, resulting in a clean and aesthetically pleasing document layout, thereby enhancing document readability.
[0110] Step S302: Extract the first top distance and the first bottom distance of the embedded shape from the virtual font metric, and extract the text height information from the virtual node attribute metric;
[0111] Wherein, the first top distance is the distance from the first baseline position to the upper boundary of the embedded shape, and the first bottom distance is the distance from the first baseline position to the lower boundary of the embedded shape; the text height information includes parameters that can affect the text height. For example, the text height information can be text size information, or the text height information can also include the top distance and bottom distance of the text. That is to say, the virtual node attribute measurement can include text size information, or the virtual node attribute measurement can also include the top distance, bottom distance and baseline position of the text.
[0112] In one possible implementation, the virtual node attribute measure includes virtual runtime attribute measure and virtual paragraph attribute measure. Specifically, the process of extracting text height information from the virtual node attribute measure may involve obtaining version compatibility information of the document carrying the embedded shape, and then extracting the text height information from either the virtual runtime attribute measure or the virtual paragraph attribute measure based on the version compatibility information. The virtual paragraph attribute measure may include a second baseline position, a second top distance, a second bottom distance, etc., while the virtual runtime attribute measure may include a second baseline position, a second top distance, a second bottom distance, etc.; the version compatibility information comprises information on all version numbers within the time range compatible with the document carrying the embedded shape.
[0113] Specifically, the version compatibility information of the document carrying the embedded shape is obtained through the compatibility checker. Using the version compatibility information as a judgment condition, the second top distance and the second bottom distance are extracted from the virtual running attribute measure as text height information, or the second top distance and the second bottom distance are extracted from the virtual paragraph attribute measure as text height information.
[0114] Since historical versions of documents may be in binary or XML file formats, different file formats have different compatibility with paragraph attribute measures in paragraph nodes and runtime attribute measures in runtime nodes. By using version compatibility information to select which virtual node attribute measures to extract text height information from, problems such as data reading errors and program crashes that may occur when accessing incompatible nodes can be avoided, thereby improving the accuracy and smoothness of extracting text height information.
[0115] In one possible implementation, the process of extracting text height from virtual runtime attribute metrics or virtual paragraph attribute metrics based on version compatibility information can be specifically as follows: when the version compatibility information indicates that the document is compatible with versions within the historical time period, text height information is extracted from virtual runtime attribute metrics; when the version compatibility information indicates that the document is compatible with versions outside the historical time period, text height information is extracted from virtual paragraph attribute metrics.
[0116] Specifically, refer to Figure 7 , Figure 7 An optional schematic flowchart illustrating the height increment and text height information acquisition rules provided in this embodiment of the disclosure is shown below. Figure 7 As shown in the right branch, when the document compatibility version in the obtained version compatibility information is within the document compatibility history time period, the virtual running attribute metric is accessed, and the second top distance and the second bottom distance are extracted from the virtual running attribute metric. The second top distance and the second bottom distance are used as text height information. If the document compatibility version in the obtained version compatibility information is not within the document compatibility history time period, the virtual paragraph attribute metric is accessed, and the second top distance and the second bottom distance are extracted from the virtual paragraph attribute metric. The second top distance and the second bottom distance are used as text height information.
[0117] By determining whether a document is compatible with versions within or outside a historical time period, the source of text height information can be reasonably determined based on the historical time period. This allows for the extraction of text height information from appropriate attribute metrics, thereby improving the stability of text height information extraction.
[0118] Step S303: Determine the shape height of the embedded shape based on the first top distance and the first bottom distance, and determine the height of the virtual text corresponding to the embedded shape based on the text height information;
[0119] Specifically, the absolute values of the first top distance and the first bottom distance are added together to obtain the shape height of the embedded shape. Then, the virtual text height of the corresponding text is determined based on the text height information. The virtual text height is the border height of the text border when the embedded shape is regarded as a virtual text.
[0120] When the text height information includes top and bottom distances, extract the second top and bottom distances from the virtual running attribute metric, add the absolute values of the second top and bottom distances, and determine the sum as the virtual text height; or, extract the second top and bottom distances from the virtual paragraph attribute metric, add the absolute values of the second top and bottom distances, and determine the sum as the virtual text height.
[0121] When the text height information is the text size information, call the built-in mapping interface function of the document, use the font and font size as the input parameters of the mapping interface function, and transmit them to the background server of the document through the mapping interface function. The font parameter database of the background server contains the font metric data of all fonts. The background server retrieves based on the received font and font size in the font parameter database, obtains the border height of the text border corresponding to the text in this font and font size, returns the border height of the text border through the mapping interface function, and uses the border height of the text border as the virtual text height corresponding to the embedded shape.
[0122] Refer to Figure 8 , Figure 8 , which is an optional schematic diagram of the text mapping structure constructed based on the virtual running property measurement provided by the embodiments of the present disclosure. Taking the baseline as the starting position of text drawing, the font of the drawn text "reading" is regular script and the font size is 30. By retrieving in the font parameter database, the width of the text border of the text "reading" with the loaded font of regular script and font size of 30 is w, and the height is h. For the convenience of understanding, the text border is replaced by a gray rectangular area, and the height of the gray rectangle is used as the virtual text height, that is, the virtual text height is consistent with the border height of the text border. At this time, the virtual text height is h. Based on the virtual text height, the distance from the baseline position to the upper boundary of the text border is used as the top distance, and the distance from the baseline position to the lower boundary of the text border is used as the bottom distance. When an underline is configured for the text, the underline position is in the middle of the baseline position and the lower boundary of the text border, that is, the middle position of the bottom distance, as shown by the solid line segment in Figure 8 . It should be noted that the underline position is within the area where the text border is located. According to the above description, the text mapping structure can be expressed as {baseline position, top distance, bottom distance, underline position}.
[0123] Step S304: Determine the target line height corresponding to the embedded shape according to the shape height and the virtual text height.
[0124] Specifically, generally, the corresponding target line height can be calculated according to the shape height, the virtual text height, and the line spacing multiple of the line where the embedded shape is located. When an underline is configured for the embedded shape, the height increment generated by configuring the underline needs to be calculated. At this time, the corresponding target line height needs to be calculated according to the shape height, the virtual text height, the height increment, and the line spacing multiple of the line where the embedded shape is located.
[0125] In one possible implementation, when the embedded shape is configured with an underline, in the process of determining the target line height corresponding to the embedded shape based on the shape height and the virtual text height, specifically, the height increment generated by the underline can be determined, and the target line height corresponding to the embedded shape can be determined based on the shape height, the virtual text height, and the height increment.
[0126] Specifically, when configuring underlines for embedded shapes, such as Figure 7 As shown in the left branch, the underline position is obtained from the virtual running attribute metric, and the first baseline position, first top distance, and first bottom distance are obtained from the virtual font metric. The shape height is determined based on the first top distance and first bottom distance, the virtual text height is determined based on the text height information, and the height increment is determined based on the height difference between the shape height and the virtual text height. The underline position obtained from the virtual running attribute metric is adjusted based on the first baseline position, and the underline position is shifted downwards along the vertical direction by the height increment to obtain the target drawing position of the underline. Then, the target line height corresponding to the embedded shape is determined based on the shape height of the embedded shape, the virtual text height, and the height increment. By taking into account the shape height of the embedded shape, the virtual text height of the text border, and the height increment generated when configuring the underline, the influence of all elements in the text line on the line height is comprehensively considered, effectively improving the reliability of the target line height calculation result.
[0127] In one possible implementation, the process of determining the target line height corresponding to the embedded shape based on the shape height, virtual text height, and height increment can specifically involve determining the line spacing multiple configured for the embedded shape, determining an adjustment coefficient based on the difference between the line spacing multiple and the unit multiple, obtaining the adjusted virtual text height by multiplying the adjustment coefficient by the virtual text height, and finally obtaining the target line height corresponding to the embedded shape based on the sum of the shape height, the adjusted virtual text height, and the height increment. Here, the unit multiple can be considered as a line spacing multiple of 1, and the adjustment coefficient can be considered as the line spacing increment relative to the unit multiple.
[0128] Specifically, the line spacing value is obtained from the paragraph attribute metric. This line spacing value is used as the line spacing multiple for the embedded shape configuration. The difference between the line spacing multiple and the unit multiple is calculated, and this difference is determined as the adjustment coefficient. Then, the product of the adjustment coefficient and the virtual text height is calculated to obtain the adjusted virtual text height. Next, the underline position is obtained from the virtual run attribute metric. Based on the text height information and the obtained underline position, the height increment is determined. Finally, the sum of the shape height, the adjusted virtual text height, and the height increment is calculated to obtain the target line height corresponding to the embedded shape. For example, assuming the virtual text height is 8, the shape height is 6, the height increment is 1, and the line spacing obtained from the virtual paragraph attribute metric is 1.5 times the line spacing, then the line spacing multiple for the embedded shape configuration is 1.5, the adjustment coefficient is 1.5 - 1 = 0.5, the adjusted virtual text height is 0.5 × 8 = 4, and the target line height corresponding to the embedded shape is 6 + 4 + 1 = 11.
[0129] Based on the above description, when an underline is configured for an embedded shape, the target row height H of the embedded shape can be represented by the following formula, where h shape h is the shape height, α is the adjustment factor, and h is the height. text Δh represents the height of the virtual text. line To configure the height increment when an underline is displayed, p spacing Line spacing is a measure of the virtual paragraph attributes.
[0130] H = h shape +αh text +Δh line
[0131] α=(p spacing -1)
[0132] Additionally, when no underline is configured for the embedded shape, there is no need to calculate the height increment. The target line height of the embedded shape can be obtained by calculating the sum of the shape height and the adjusted virtual text height. In this case, the target line height H of the embedded shape can be represented by the following formula.
[0133] H = h shape +αh text
[0134] By determining the adjustment coefficient based on the difference between the line spacing multiple and the unit multiple, the virtual text height can be adjusted in a refined manner based on the product of the adjustment coefficient and the virtual text height. This effectively improves the accuracy of the target line height when the target line height corresponding to the embedded shape is obtained based on the sum of the shape height, the adjusted virtual text height, and the height increment.
[0135] Reference Figure 9 , Figure 9This is a schematic diagram of an optional flowchart for calculating the target line height provided in an embodiment of this disclosure. A virtual text metric is constructed based on the original shape parameters of the embedded shape inserted into the document. A virtual runtime attribute metric and a virtual paragraph attribute metric are constructed based on the paragraph parameters inserted into the embedded shape. Depending on version compatibility information, either the virtual runtime attribute metric or the virtual paragraph attribute metric is selected to extract text height information. The virtual text height is determined based on the text height information. Next, a first top distance and a first bottom distance are extracted from the virtual text metric. The shape height of the embedded shape is determined based on the first top distance and the first bottom distance. The virtual text height is multiplied by the difference between the line spacing multiple and the unit multiple to obtain the adjusted virtual text height. When an underline is configured for the embedded shape, and the document compatibility version in the version compatibility information is within the document compatibility history time period, the height increment for configuring the underline is determined based on the virtual runtime attribute metric and the virtual text metric. The target line height of the line containing the embedded shape is obtained based on the shape height, the adjusted virtual text height, and the height increment. Additionally, when an underline is configured for an embedded shape, and the document compatibility version in the version compatibility information is not within the document compatibility history period, the target line height can be simply calculated by multiplying the shape height of the embedded shape by the line spacing of the line containing the embedded shape. By combining version compatibility information to choose between virtual run attribute measures or virtual paragraph attribute measures to extract text height information, the extraction of text height information can be made more stable and its accuracy improved.
[0136] In one possible implementation, the virtual node attribute measurement includes a virtual running attribute measurement. In determining the height increment generated by the underline, specifically, the first baseline position of the embedded shape can be extracted from the virtual font measurement, the corresponding second bottom distance and second baseline position can be determined based on the text height information in the virtual running attribute measurement, the first bottom distance or the second bottom distance can be adjusted so that the first baseline position is aligned with the second baseline position, and the height increment generated by the underline can be obtained based on the difference between the adjusted second bottom distance and the first bottom distance.
[0137] Specifically, based on the alignment configured for the embedded shape, the first baseline position of the embedded shape is extracted from the virtual font metric, and the corresponding second bottom distance and second baseline position are extracted from the virtual runtime attribute metric. Alternatively, the virtual text height is determined based on the font and font size in the runtime attribute metric, and the second baseline position and second bottom distance corresponding to the text border of the embedded line are determined based on the virtual text height and paragraph alignment. The area corresponding to the first top distance is taken as the first top area, the area corresponding to the first bottom distance is taken as the first bottom area, the area corresponding to the second top distance is taken as the second top area, and the area corresponding to the second bottom distance is taken as the second bottom area. The positions of the first top area and the first bottom area are adjusted by equal absolute values so that the first baseline position aligns with the second baseline position. After adjustment, the height of the first top area and the first bottom area remains unchanged, i.e., the first top distance and the first bottom distance remain unchanged. Alternatively, the positions of the second top area and the second bottom area are adjusted so that the second baseline position aligns with the first baseline position. After adjustment, the height of the second top area and the second bottom area remains unchanged, i.e., the second top distance and the second bottom distance remain unchanged. When the first baseline position is aligned with the second baseline position, and the absolute value of the second bottom distance is greater than the absolute value of the first bottom distance, the difference between the second bottom distance and the first bottom distance is calculated, and this difference is used as the height increment generated when configuring the underline. The height increment Δh generated when configuring the underline. line It can be calculated using the following formula, where, The second bottom distance, This is the first bottom distance.
[0138]
[0139] By aligning the first baseline position with the second baseline position, the relative position between the embedded shape and the text border can be ensured to be accurate, thus obtaining accurate height increments to better determine the drawing position of the underline. Simultaneously, abstracting the top and bottom distances into regions allows for a more intuitive understanding of the alignment process between the first and second baseline positions. These regions can be viewed as virtual spaces formed around the baseline, top boundary, and bottom boundary. These virtual spaces define the vertical positions of the embedded shape and text border. By adjusting the positions of these regions, the layout position of the embedded shape and text border can be accurately controlled, resulting in a more refined typography effect.
[0140] In one possible implementation, when the text height information is the same as the text size information, in determining the corresponding second bottom distance and second baseline position based on the text height information in the virtual running attribute metric, the text size information in the virtual running attribute metric can be used as an input parameter to the surveying interface function. The surveying interface function is then called, and the corresponding second bottom distance and second baseline position are returned based on the surveying interface function. Here, the surveying interface function is used to transmit and return data related to drawing the underline.
[0141] Specifically, the paragraph alignment can be obtained from the existing paragraph attribute metrics. The document's built-in mapping interface function is then called, using the font, font size, and paragraph alignment from the virtual runtime attribute metrics as input parameters. This data is passed to the document's backend server. The backend server obtains the second baseline position using the paragraph alignment. Next, the font rendering engine is enabled to obtain the width and height of the text borders for the specific font and font size. Based on the second baseline position, the text border height, and the top and bottom boundaries of the text borders, the second top distance and second bottom distance of the text borders are obtained. The second bottom distance and the second baseline position are returned through the mapping interface function to calculate the height increment when configuring underlines. Alternatively, only the font and font size from the virtual runtime attribute metrics can be used as input parameters to the mapping interface function, and the backend server can directly read the current paragraph alignment and return it through the mapping interface function. Since the data processing logic of the surveying interface function is encapsulated, the process of obtaining data can be simplified by calling the surveying interface function. In addition, the surveying interface function supports a variety of security mechanisms, which can protect the transmitted data from unauthorized access or tampering, thereby enhancing the reliability of the data.
[0142] Alternatively, a font parameter database can be constructed, with the data stored in the form of a hash table. The width and height of the text borders for all fonts and font size combinations are obtained through the font rendering engine. The baseline position is determined based on the paragraph alignment. Then, the top and bottom distances are determined using the text border height, the top and bottom boundaries of the text border, and the baseline position. The paragraph alignment, font, font size, baseline position, top distance, and bottom distance are associated and saved as a data entry in the font parameter database, and a retrieval value is generated for this data entry. The font measurement data stored in the font parameter database is shown in Table 1. Table 1 is an optional schematic table of the font parameter database provided in this embodiment of the present disclosure, where the first position is the position located at the horizontal midline of the text border, and the second position is the position located at the bottom boundary of the text border. If the current paragraph alignment is center-aligned and the text in the paragraph is SimSun font, size 10, then center alignment, SimSun font, and size 10 are used as search keys. A preset hash function is used to calculate the search value based on the search key. The search is then used to find the corresponding data entry in the font parameter database. When the search key successfully matches the search value of the retrieved data entry, the baseline position "first position", top distance "T1", and bottom distance "B1" are returned. The first position is used as the second baseline position, T1 as the second top distance, and B1 as the second bottom distance. By constructing a font parameter database, the required baseline position, top distance, and bottom distance can be directly obtained from the font parameter database without further calculation, effectively improving the efficiency of data retrieval.
[0143] Table 1 Font Parameter Database
[0144]
[0145]
[0146] In one possible implementation, in the process of adjusting the first bottom distance or the second bottom distance to align the first baseline position with the second baseline position, specifically, a first position difference between the first baseline position and the second baseline position can be determined, and the first bottom distance or the second bottom distance can be adjusted according to the first position difference to align the first baseline position with the second baseline position.
[0147] Specifically, when the first baseline position and the second baseline position are not aligned, a first position difference between the first baseline position and the second baseline position is calculated. The first top region and the first bottom region are simultaneously moved vertically along a first direction by a distance equal to the first position difference. Alternatively, the second bottom region and the second top region are simultaneously moved vertically along a second direction by a distance equal to the first position difference, so that the first baseline position is aligned with the second baseline position. Here, the first direction and the second direction are opposite directions; when the first direction is upward vertical movement, the second direction is downward vertical movement. For example, refer to... Figure 10 , Figure 10 This is an optional schematic diagram illustrating the alignment of a first baseline position with a second baseline position according to an embodiment of this disclosure. The left side represents an embedded shape, and the right side represents the text border of the line containing the embedded shape. The paragraph alignment configured for the embedded shape is center alignment, and the alignment configured for the embedded shape is also center alignment. Therefore, the first baseline position and the second baseline position are located on the midline of the embedded shape and the text border, respectively. When the first baseline position and the second baseline position are not aligned, the second baseline position is considered as the center alignment reference axis of the line. The first position difference Δx between the first baseline position and the center alignment reference axis is calculated. The first top region and the first bottom region are moved downwards by a distance Δx in the vertical direction. When the lower boundary of the first top region and the upper boundary of the first bottom region both coincide with the center alignment reference axis, the alignment of the first baseline position and the second baseline position is completed. Alternatively, the first baseline position can be regarded as the center alignment reference axis of the row. The second top region and the second bottom region are moved upward by a distance Δx in the vertical direction. When the lower boundary of the second top region and the upper boundary of the second bottom region coincide with the center alignment reference axis, the alignment of the first baseline position and the second baseline position is completed.
[0148] By determining the first position difference between the first baseline position and the second baseline position, the first bottom distance or the second bottom distance can be quickly adjusted based on the first position difference, thereby improving the alignment efficiency between the first baseline position and the second baseline position.
[0149] In one possible implementation, the process of determining the first top distance and the first bottom distance based on the shape height can specifically involve determining the alignment method configured for the embedded shape, determining the first baseline position of the embedded shape based on the alignment method, and determining the first top distance and the first bottom distance based on the first baseline position and the shape height. The alignment method of the embedded shape can include center alignment, top alignment, bottom alignment, etc.
[0150] Specifically, after embedding the embedded shape into the document, an alignment method is configured for the embedded shape. The first baseline position of the embedded shape is determined based on the alignment method. The distance between the first baseline position and the upper boundary of the embedded shape is defined as the first top distance, and the distance between the first baseline position and the lower boundary of the embedded shape is defined as the first bottom distance. For example, assuming the shape height is h, the first top distance from the first baseline position to the upper boundary of the embedded shape is... The distance from the first baseline position to the first bottom edge of the embedded shape is: Reference Figure 11 , Figure 11 This is an optional schematic diagram of the first baseline position configuration provided in an embodiment of this disclosure. An embedded shape is represented by a gray rectangular area. When the embedded rectangle is configured with center alignment, the first baseline position is configured on the horizontal center line of the embedded rectangle, such as... Figure 11 As shown in (a), the distance from the first top is... First bottom distance When the embedded rectangle is configured with bottom alignment, the first baseline position is set at the bottom boundary of the embedded rectangle, such as... Figure 11 As shown in (b) above, the distance from the first top is... First bottom distance When the embedded rectangle is configured with top alignment, the first baseline position is set at the top boundary of the embedded rectangle, such as... Figure 11 As shown in (c), the distance from the first top is... First bottom distance
[0151] By combining the first baseline position and the shape height, the first top distance and the first bottom distance can be accurately determined, thereby enabling the subsequent construction of accurate virtual font measurements.
[0152] It's important to note that the alignment of embedded shapes is configured based on the paragraph alignment of the paragraph containing the embedded shape. For example, when the paragraph alignment is center-aligned, the embedded shape can be configured with center alignment; when the paragraph alignment is justified, the embedded shape can be configured with bottom alignment. This method of configuring embedded shape alignment ensures the reasonable alignment between the embedded shape and the text border, effectively avoiding visual inconsistencies caused by inconsistent baseline positions (e.g., the first baseline of the embedded shape is located at the top edge of the embedded shape while the second baseline of the text border is located at the center line of the text border), thereby improving the overall layout quality of the document.
[0153] In one possible implementation, after obtaining the target line height, the embedded shape can be drawn. Specifically, this can involve extracting the first baseline position of the embedded shape from virtual font measurements, determining the offset of the embedded shape relative to its line based on the first baseline position and the target line height, and then drawing the embedded shape based on the offset. More specifically, after obtaining the target line height, a reference centerline is constructed within the line containing the embedded shape based on that height. This reference centerline can be considered as an alignment reference line when the paragraph alignment of the text line is configured for center alignment. (See reference...) Figure 12 , Figure 12 This is an optional schematic diagram of adjusting the position of an embedded shape according to an embodiment of the present disclosure. The first baseline position of the embedded shape configured for center alignment is extracted from the virtual font metric. The distance from the first baseline position to the reference center axis is calculated. This distance is used as the offset of the embedded shape relative to its row. The display position of the embedded shape is adjusted based on the offset to obtain the target drawing position. The embedded shape is drawn at the target drawing position so that the drawn embedded shape can be centered and aligned with the text border of the row in which the embedded shape is located.
[0154] By extracting the first baseline position from the virtual font metric, the offset can be further determined to accurately draw the embedded shape. At the same time, the virtual font metric can be reused when determining the target line height and drawing the embedded shape, improving data processing efficiency.
[0155] Furthermore, after obtaining the target line height, the target line height can be associated with the corresponding alignment, font, and font size and saved to the font parameter database. When line height calculation is required later, the font parameter database can be searched to see if the corresponding line height is saved. If the corresponding line height exists, it can be returned directly for use; if the corresponding line height does not exist, the baseline position, top distance, and bottom distance are returned for line height calculation.
[0156] Reference Figure 13 , Figure 13 This is a schematic diagram of an optional overall process for determining row height according to an embodiment of this disclosure. The principle of the row height determination method in this embodiment of the disclosure is described in general as follows:
[0157] When a layout image is inserted into the document, its outline is abstracted as an embedded rectangle. First, the initial shape parameters of the embedded rectangle, the initial paragraph attributes of the paragraph into which the embedded rectangle is inserted, and the initial text attributes within the paragraph are obtained. The paragraph alignment is extracted from the initial paragraph attributes, and the alignment of the embedded rectangle is configured based on the paragraph alignment.
[0158] Next, the height and scaling factor or vertical stretching factor of the embedded rectangle are extracted from its initial shape parameters. Based on the scaling factor or vertical stretching factor, the current height of the embedded rectangle displayed in the document is determined. A first baseline position is configured within the area occupied by the embedded rectangle based on the configured alignment. The distance from the first baseline position to the upper boundary of the embedded rectangle is defined as the first top distance, and the distance from the first baseline position to the lower boundary of the embedded rectangle is defined as the first bottom distance. A virtual font metric is constructed based on the first baseline position, the first top distance, and the first bottom distance. This virtual font metric is used to describe the geometric structure of the embedded rectangle using text mapping.
[0159] Next, the paragraph font, font size, and alignment are extracted from the initial paragraph attributes. The mapping interface function is then called, with the paragraph alignment, font, and font size as input parameters. These parameters are passed to the document's backend server. The backend server obtains the second baseline position using the paragraph alignment. Then, the font rendering engine is enabled to obtain the width and height of the text borders for the specific font and font size. Based on the second baseline position, the border height, and the top and bottom boundaries of the text borders, the second top distance and second bottom distance of the text borders are obtained. The second top distance, second bottom distance, and second baseline position are returned through the mapping interface function. A virtual paragraph attribute metric is then constructed based on the second top distance, second bottom distance, and second baseline position.
[0160] Next, extract the text font, font size, and underline status from the initial running attributes. Call the mapping interface function, taking the paragraph alignment, font, and font size as input parameters to the mapping interface function, and pass them to the document's backend server. The backend server obtains the second baseline position through the paragraph alignment. Then, enable the font rendering engine to obtain the width and height of the text border under the specific font and font size. Based on the second baseline position, the border height of the text border, and the upper and lower boundaries of the text border, obtain the second top distance and the second bottom distance corresponding to the text border. Return the second top distance, the second bottom distance, and the second baseline position through the mapping interface function. Construct virtual running attribute metrics based on the second top distance, the second bottom distance, and the second baseline position.
[0161] Next, the first top distance and the first bottom distance of the embedded rectangle are extracted from the virtual font metric. The absolute values of the first top distance and the first bottom distance are added together to obtain the shape height of the embedded rectangle. Then, the version compatibility information of the document carrying the embedded shape is obtained. When the document compatibility version in the obtained version compatibility information is within the document compatibility history time period, the second top distance and the second bottom distance are extracted from the virtual running attribute metric and used as the text height information. When the document compatibility version in the obtained version compatibility information is within the document compatibility history time period, the second top distance and the second bottom distance are extracted from the virtual paragraph attribute metric and used as the text height information.
[0162] After obtaining the text height information, the second top distance and the second bottom distance are extracted from the virtual running attribute metric. The absolute values of the second top distance and the second bottom distance are added together, and the sum is determined as the virtual text height. Alternatively, the second top distance and the second bottom distance are extracted from the virtual paragraph attribute metric. The absolute values of the second top distance and the second bottom distance are added together, and the sum is determined as the virtual text height.
[0163] Next, after obtaining the shape height of the embedded rectangle and the virtual text height of the corresponding text border, the paragraph line spacing is obtained from the initial paragraph properties. The difference between the paragraph line spacing and single line spacing is used as an adjustment factor. This adjustment factor is multiplied by the virtual text height to obtain the adjusted virtual text height. Finally, the shape height is added to the adjusted virtual text height to obtain the target line height.
[0164] When configuring an underline for an embedded rectangle, the embedded rectangle and the text border must first be aligned. Specifically, this involves adjusting the first top and bottom distances, or adjusting the second top and bottom distances, so that the first baseline position aligns with the second baseline position. The area corresponding to the first top distance is designated as the first top area, the area corresponding to the first bottom distance as the first bottom area, the area corresponding to the second top distance as the second top area, and the area corresponding to the second bottom distance as the second bottom area. When the first and second baseline positions are not aligned, a first position difference between them is calculated. The first top and first bottom areas are then simultaneously moved vertically along a first direction by the first position difference distance, or the second bottom and second top areas are simultaneously moved vertically along a second direction by the first position difference distance, so that the first baseline position aligns with the second baseline position. The first and second directions are opposite; if the first direction is upward vertically, the second direction is downward vertically.
[0165] Next, based on the difference between the first bottom distance and the second bottom distance after aligning with the first baseline position and the second baseline position, the height increment is calculated to obtain the height increment generated when configuring the underline. The height increment is added to the shape height and the adjusted virtual text height to obtain the target line height.
[0166] Next, the underline position is extracted from the virtual running attribute metric, and the underline position is adjusted based on the first baseline position. The underline position is shifted downwards in the vertical direction by a height increment to obtain the target drawing position of the underline, and then the underline is drawn.
[0167] It is understood that although the steps in the above flowcharts are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated in this embodiment, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the above flowcharts may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.
[0168] Reference Figure 14 , Figure 14 A schematic diagram of a row height determination device is provided for an embodiment of this disclosure. The row height determination device 1300 includes:
[0169] The first processing module 1401 is used to read the virtual font measurement and the virtual node attribute measurement of the embedded shape. The virtual node attribute measurement is constructed on the basis of the original node attribute measurement of the target node. The target node is the node to which the embedded shape belongs in the document object model tree. The virtual font measurement is constructed on the basis of the original shape measurement of the embedded shape.
[0170] The second processing module 1402 is used to extract the first top distance and the first bottom distance of the embedded shape from the virtual font measurement, and to extract the text height information from the virtual node attribute measurement.
[0171] The third processing module 1303 is used to determine the shape height of the embedded shape based on the first top distance and the first bottom distance, and to determine the virtual text height corresponding to the embedded shape based on the text height information.
[0172] The fourth processing module 1404 is used to determine the target line height corresponding to the embedded shape based on the shape height and the virtual text height.
[0173] Furthermore, based on the shape height and the virtual text height, the target line height corresponding to the embedded shape is determined. The fourth processing module 1404 is also used for:
[0174] When an embedded shape is configured with an underline, determine the height increment produced by the underline;
[0175] The target row height corresponding to the embedded shape is determined based on the shape height, virtual text height, and height increment.
[0176] Furthermore, based on the shape height, virtual text height, and height increment, the target line height corresponding to the embedded shape is determined. The fourth processing module 1404 is also used for:
[0177] Determine the line spacing multiple for the embedded shape, and determine the adjustment factor based on the difference between the line spacing multiple and the unit multiple;
[0178] The adjusted virtual text height is obtained by multiplying the adjustment factor by the virtual text height.
[0179] The target line height corresponding to the embedded shape is obtained by summing the shape height, the adjusted virtual text height, and the height increment.
[0180] Furthermore, the virtual node attribute measurement includes virtual running attribute measurement, determining the height increment generated by the underscore. The aforementioned fourth processing module 1404 is also used for:
[0181] The first baseline position of the embedded shape is extracted from the virtual font metric, and the corresponding second bottom distance and second baseline position are determined based on the text height information in the virtual running attribute metric.
[0182] Adjust the first bottom distance or the second bottom distance so that the first baseline position is aligned with the second baseline position. Based on the difference between the adjusted second bottom distance and the first bottom distance, obtain the height increment generated by the underline.
[0183] Furthermore, the text height information is the text size information. Based on the text height information in the virtual running attribute measurement, the corresponding second bottom distance and second baseline position are determined. The aforementioned fourth processing module 1404 is also used for:
[0184] Use the text size information in the virtual running attribute measurement as the input parameter of the surveying interface function, and call the surveying interface function;
[0185] The mapping interface function returns the corresponding second bottom distance and second baseline position.
[0186] Furthermore, by adjusting the first bottom distance or the second bottom distance to align the first baseline position with the second baseline position, the fourth processing module 1404 is also used for:
[0187] Determine the first positional difference between the first baseline position and the second baseline position;
[0188] Adjust the first bottom distance or the second bottom distance according to the first position difference so that the first baseline position is aligned with the second baseline position.
[0189] Furthermore, the virtual node attribute measurement includes virtual running attribute measurement and virtual paragraph attribute measurement. Text height information is extracted from the virtual node attribute measurement. The second processing module 1402 is also used for:
[0190] Obtain version compatibility information for the document containing the embedded shape;
[0191] Text height information is extracted from virtual runtime attribute metrics or virtual paragraph attribute metrics based on version compatibility information.
[0192] Furthermore, based on version compatibility information, the text height information is extracted from virtual runtime attribute metrics or virtual paragraph attribute metrics. The second processing module 1402 is also used for:
[0193] When version compatibility information indicates that a document is compatible with versions within a historical time period, extract text height information from virtual runtime attribute metrics;
[0194] When version compatibility information indicates that a document is compatible with versions outside of a historical time period, text height information is extracted from virtual paragraph attribute metrics.
[0195] Furthermore, before reading the virtual font measurement and the virtual node attribute measurement of the embedded shape, the first processing module 1401 is also used to:
[0196] Obtain the shape height, and determine the first top distance and the first bottom distance based on the shape height;
[0197] A virtual font metric is constructed based on the first top distance and the first bottom distance;
[0198] Obtain text size information from the original node attribute metrics of the target node, and construct virtual node attribute metrics based on the text size information.
[0199] Furthermore, based on the text size information, a virtual node attribute metric is constructed. The first processing module 1401 is also used for:
[0200] Use the text size information as the input parameter to the surveying interface function, and then call the surveying interface function.
[0201] Based on the second top distance, second bottom distance, and second baseline position returned by the surveying interface function, virtual node attribute metrics are constructed based on the second top distance, second bottom distance, and second baseline position.
[0202] Furthermore, based on the first top distance and the first bottom distance, a virtual font metric is constructed, and the aforementioned first processing module 1401 is also used for:
[0203] Obtain the first baseline position of the embedded shape;
[0204] A virtual font metric is constructed based on the first baseline position, the first top distance, and the first bottom distance.
[0205] Furthermore, based on the shape height, the first top distance and the first bottom distance are determined, and the aforementioned first processing module 1401 is also used for:
[0206] Determine the alignment of the embedded shape, and determine the first baseline position of the embedded shape based on the alignment.
[0207] The first top distance and the first bottom distance are determined based on the first baseline position and the shape height.
[0208] Furthermore, the aforementioned fourth processing module 1404 is also used for:
[0209] Extract the first baseline position of the embedded shape from the virtual font measurement, and determine the offset of the embedded shape relative to the row based on the first baseline position and the target row height;
[0210] Draw the embedded shape based on the offset.
[0211] The electronic device provided in this disclosure for executing the above-described row height determination method or model training method can be a terminal, as shown in the embodiments below. Figure 15 , Figure 15 This is a partial structural block diagram of a terminal provided in an embodiment of the present disclosure. The terminal includes: a camera assembly 1510, a first memory 1520, an input unit 1530, a display unit 1540, a sensor 1550, an audio circuit 1560, a wireless fidelity (WiFi) module 1570, a first processor 1580, and a first power supply 1590, among other components. Those skilled in the art will understand that... Figure 15 The terminal structure shown does not constitute a limitation on the terminal and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0212] The camera assembly 1510 can be used to capture images or videos. Optionally, the camera assembly 1510 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions.
[0213] The first memory 1520 can be used to store software programs and modules. The first processor 1580 executes various functional applications and data processing of the terminal by running the software programs and modules stored in the first memory 1520.
[0214] The input unit 1530 can be used to receive input numeric or character information, and to generate key signal inputs related to the terminal's settings and function control. Specifically, the input unit 1530 may include a touch panel 1531 and other input devices 1532.
[0215] The display unit 1540 can be used to display input or provided information, as well as various menus of the terminal. The display unit 1540 may include a display panel 1541.
[0216] Audio circuitry 1560, speaker 1561, and microphone 1562 provide an audio interface.
[0217] The first power source 1590 can be AC power, DC power, a disposable battery, or a rechargeable battery.
[0218] The number of sensors 1550 can be one or more, and these sensors 1550 include, but are not limited to: accelerometers, gyroscopes, pressure sensors, optical sensors, etc.
[0219] An accelerometer can detect the magnitude of acceleration along the three axes of a coordinate system established by the terminal. For example, an accelerometer can be used to detect the components of gravitational acceleration along the three axes. The first processor 1580 can control the display unit 1540 to display the user interface in either a horizontal or vertical view based on the gravitational acceleration signal acquired by the accelerometer. The accelerometer can also be used for games or for acquiring user motion data.
[0220] The gyroscope sensor can detect the terminal's orientation and rotation angle. It can work in conjunction with an accelerometer to collect 3D user movements on the terminal. Based on the data collected by the gyroscope sensor, the first processor 1580 can perform the following functions: motion sensing (e.g., changing the UI based on the user's tilt), image stabilization during shooting, game control, and inertial navigation.
[0221] The pressure sensor can be installed on the side bezel of the terminal and / or on the lower layer of the display unit 1540. When the pressure sensor is installed on the side bezel of the terminal, it can detect the user's grip signal on the terminal, and the first processor 1580 can perform left / right hand recognition or quick operation based on the grip signal collected by the pressure sensor. When the pressure sensor is installed on the lower layer of the display unit 1540, the first processor 1580 can control the operable controls on the UI interface based on the user's pressure operation on the display unit 1540. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0222] An optical sensor is used to collect ambient light intensity. In one embodiment, the first processor 1580 can control the display brightness of the display unit 1540 based on the ambient light intensity collected by the optical sensor. Specifically, when the ambient light intensity is high, the display brightness of the display unit 1540 is increased; when the ambient light intensity is low, the display brightness of the display unit 1540 is decreased. In another embodiment, the first processor 1580 can also dynamically adjust the shooting parameters of the camera assembly 1510 based on the ambient light intensity collected by the optical sensor.
[0223] In this embodiment, the first processor 1580 included in the terminal can execute the row height determination method or the model training method of the previous embodiment.
[0224] The electronic device provided in this disclosure for executing the above-described row height determination method or model training method can also be a server, see below. Figure 16 , Figure 16This is a partial structural block diagram of a server provided in an embodiment of the present disclosure. The server can vary significantly due to differences in configuration or performance. It may include one or more second processors 1610 and second memories 1630, and one or more storage media 1640 (e.g., one or more mass storage devices) for storing application programs 1643 or data 1642. The second memories 1630 and storage media 1640 may be temporary or persistent storage. The program stored in the storage media 1640 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server. Furthermore, the second processor 1610 may be configured to communicate with the storage media 1640 and execute the series of instruction operations stored in the storage media 1640 on the server.
[0225] The server may also include one or more secondary power supplies 1620, one or more wired or wireless network interfaces 1650, one or more input / output interfaces 1660, and / or one or more operating systems 1641, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0226] The second processor 1610 in the server can be used to execute row height determination methods or model training methods.
[0227] This disclosure also provides a computer-readable storage medium for storing a computer program for executing the row height determination method or model training method of the foregoing embodiments.
[0228] This disclosure also provides a computer program product comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the row height determination method or model training method described above.
[0229] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in this disclosure and the foregoing drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate to describe embodiments of this disclosure, for example, those that can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatuses.
[0230] It should be understood that in this disclosure, "at least one item" means one or more, and "more than one" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0231] It should be understood that in the description of the embodiments of this disclosure, "multiple" means two or more, "greater than", "less than", "exceeding" etc. are understood to exclude the number itself, and "above", "below", "within" etc. are understood to include the number itself.
[0232] In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0233] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0234] Furthermore, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0235] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0236] It should also be understood that the various implementation methods provided in this disclosure can be combined arbitrarily to achieve different technical effects.
[0237] The above is a detailed description of the preferred embodiments of this disclosure. However, this disclosure is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this disclosure. All such equivalent modifications or substitutions are included within the scope defined by the claims of this disclosure.
Claims
1. A method for determining row height, characterized in that, include: Read the virtual font measurement of the embedded shape and the virtual node attribute measurement of the embedded shape, wherein the virtual node attribute measurement is constructed on the basis of the original node attribute measurement of the target node, the target node is the node to which the embedded shape belongs in the document object model tree, and the virtual font measurement is constructed on the basis of the original shape measurement of the embedded shape. The first top distance and the first bottom distance of the embedded shape are extracted from the virtual font metric, and the text height information is extracted from the virtual node attribute metric. The shape height of the embedded shape is determined based on the first top distance and the first bottom distance, and the virtual text height corresponding to the embedded shape is determined based on the text height information. The target row height corresponding to the embedded shape is determined based on the shape height and the virtual text height.
2. The method for determining row height according to claim 1, characterized in that, Determining the target row height corresponding to the embedded shape based on the shape height and the virtual text height includes: When the embedded shape is configured with an underline, determine the height increment generated by the underline; The target row height corresponding to the embedded shape is determined based on the shape height, the virtual text height, and the height increment.
3. The method for determining row height according to claim 2, characterized in that, Determining the target row height corresponding to the embedded shape based on the shape height, the virtual text height, and the height increment includes: Determine the row spacing multiple of the embedded shape, and determine an adjustment coefficient based on the difference between the row spacing multiple and the unit multiple; The adjusted virtual text height is obtained by multiplying the adjustment coefficient by the virtual text height. The target row height corresponding to the embedded shape is obtained by summing the shape height, the adjusted virtual text height, and the height increment.
4. The method for determining row height according to claim 2, characterized in that, The virtual node attribute metrics include virtual runtime attribute metrics, and determining the height increment generated by the underscore includes: The first baseline position of the embedded shape is extracted from the virtual font metric, and the corresponding second bottom distance and second baseline position are determined based on the text height information in the virtual running attribute metric. Adjust the first bottom distance or the second bottom distance so that the first baseline position is aligned with the second baseline position, and obtain the height increment generated by the underline based on the difference between the adjusted second bottom distance and the first bottom distance.
5. The method for determining row height according to claim 4, characterized in that, The text height information is text size information. Determining the corresponding second bottom distance and second baseline position based on the text height information in the virtual running attribute metric includes: The text size information in the virtual running attribute measurement is used as the input parameter of the surveying interface function, and the surveying interface function is called. The mapping interface function returns the corresponding second bottom distance and second baseline position.
6. The method for determining row height according to claim 4, characterized in that, Adjusting the first bottom distance or the second bottom distance to align the first baseline position with the second baseline position includes: Determine a first positional difference between the first baseline position and the second baseline position; Adjust the first bottom distance or the second bottom distance according to the first position difference so that the first baseline position is aligned with the second baseline position.
7. The method for determining row height according to claim 1, characterized in that, The virtual node attribute metrics include virtual running attribute metrics and virtual paragraph attribute metrics. Extracting text height information from the virtual node attribute metrics includes: Obtain version compatibility information for the document that carries the embedded shape; The text height information is extracted from the virtual runtime attribute metric or the virtual paragraph attribute metric based on the version compatibility information.
8. The method for determining row height according to claim 7, characterized in that, The step of extracting text height information from the virtual runtime attribute metric or the virtual paragraph attribute metric based on the version compatibility information includes: When the version compatibility information indicates that the document is compatible with versions within a historical time period, the text height information is extracted from the virtual running attribute metric. When the version compatibility information indicates that the document is compatible with versions outside the historical time period, the text height information is extracted from the virtual paragraph attribute metric.
9. The method for determining row height according to claim 1, characterized in that, Before reading the virtual font measurement of the embedded shape and the virtual node attribute measurement of the embedded shape, the row height determination method further includes: Obtain the shape height, and determine the first top distance and the first bottom distance based on the shape height; The virtual font metric is constructed based on the first top distance and the first bottom distance; The text size information is obtained from the original node attribute measurement of the target node, and the virtual node attribute measurement is constructed based on the text size information.
10. The method for determining row height according to claim 9, characterized in that, The construction of the virtual font metric based on the first top distance and the first bottom distance includes: Obtain the first baseline position of the embedded shape; The virtual font metric is constructed based on the first baseline position, the first top distance, and the first bottom distance.
11. The method for determining row height according to claim 9, characterized in that, The construction of the virtual node attribute metric based on the text size information includes: The text size information is used as the input parameter of the surveying interface function, and the surveying interface function is called. The virtual node attribute metric is constructed based on the second top distance, the second bottom distance, and the second baseline position returned by the mapping interface function.
12. The method for determining row height according to claim 9, characterized in that, Determining the first top distance and the first bottom distance based on the shape height includes: Determine the alignment method configured for the embedded shape, and determine the first baseline position of the embedded shape based on the alignment method; The first top distance and the first bottom distance are determined based on the first baseline position and the shape height.
13. The method for determining row height according to claim 1, characterized in that, The method for determining row height also includes: The first baseline position of the embedded shape is extracted from the virtual font metric, and the offset of the embedded shape relative to the row is determined based on the first baseline position and the target row height. The embedded shape is drawn based on the offset.
14. A row height determining device, characterized in that, include: The first processing module is used to read the virtual font measurement of the embedded shape and the virtual node attribute measurement of the embedded shape. The virtual node attribute measurement is constructed on the basis of the original node attribute measurement of the target node. The target node is the node to which the embedded shape belongs in the document object model tree. The virtual font measurement is constructed on the basis of the original shape measurement of the embedded shape. The second processing module is used to extract the first top distance and the first bottom distance of the embedded shape from the virtual font metric, and to extract the text height information from the virtual node attribute metric. The third processing module is used to determine the shape height of the embedded shape based on the first top distance and the first bottom distance, and to determine the virtual text height corresponding to the embedded shape based on the text height information. The fourth processing module is used to determine the target row height corresponding to the embedded shape based on the shape height and the virtual text height.
15. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the row height determination method according to any one of claims 1 to 13.
16. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the row height determination method according to any one of claims 1 to 13.
17. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the row height determination method according to any one of claims 1 to 13.