Search

CN-121981074-A - Text line space configuration method, device, equipment and storage medium

CN121981074ACN 121981074 ACN121981074 ACN 121981074ACN-121981074-A

Abstract

The present disclosure relates to the technical field of computer graphics, and provides a text line space configuration method, a device, equipment and a storage medium, wherein the text line space configuration method of the present disclosure includes obtaining attribute information of a target text object, the attribute information including a semantic type corresponding to the target text object and a current font size parameter; according to the semantic type and the current font size parameter, matching and searching are carried out in a preset line space configuration set so as to determine a corresponding target line space value, the line space value corresponding to the target semantic type under different font size parameters is prestored in the preset line space configuration set, and the determined target line space value is applied to the rendering attribute of the target text object so as to control the line space layout attribute of the target text object. The method and the device effectively solve the problems that in the related art, development efficiency is low and interface visual specifications are difficult to unify due to the fact that row spacing is set one by one manually.

Inventors

  • HUANG SHOUPING
  • FU XINGXING

Assignees

  • 网易(上海)网络有限公司

Dates

Publication Date
20260505
Application Date
20251222

Claims (13)

  1. 1. A text line spacing configuration method, the method comprising: Acquiring attribute information of a target text object, wherein the attribute information comprises a semantic type corresponding to the target text object and a current font size parameter; according to the semantic type and the current font size parameter, matching and searching are carried out in a preset line space configuration set to obtain a target line space value, wherein the preset line space configuration set contains line space values corresponding to the target semantic type under different font size parameters; and applying the target line space value to the rendering attribute of the target text object to control the line space layout attribute of the target text object.
  2. 2. The method of claim 1, wherein prior to the step of performing a match lookup in a preset row spacing configuration set, the method further comprises: Judging whether the target text object has a preset self-defined line spacing value or not; If the custom line space value exists, determining the custom line space value as the target line space value, and skipping the step of matching and searching in a preset line space configuration set; And if the custom row spacing value does not exist, executing the step of matching and searching in the preset row spacing configuration set.
  3. 3. The method according to claim 1 or 2, wherein the preset row spacing configuration set includes a plurality of sub-configuration tables for different semantic types and a global default configuration table, and the performing a matching search in the preset row spacing configuration set to obtain a target row spacing value includes: Screening out a corresponding target sub-configuration table from the row spacing configuration set according to the semantic type; Searching a first row spacing value matched with the current font size parameter in the target sub-configuration table, and determining the first row spacing value as the target row spacing value; If the effective line space value matched with the current font size parameter is not found in the target sub-configuration table, a second line space value corresponding to the current font size parameter is found in the global default configuration table, and the second line space value is determined to be the target line space value.
  4. 4. The method of claim 3, wherein the attribute information further includes a current language environment identifier and a current operating platform identifier, and wherein the screening the corresponding target sub-configuration table in the line space configuration set includes: And screening a target sub-configuration table corresponding to the target text object from the row spacing configuration set according to the semantic type, the language environment identifier and the operation platform identifier.
  5. 5. The method of claim 1, wherein the performing a matching lookup in a preset row spacing configuration set to obtain a target row spacing value comprises: Acquiring a minimum word size threshold and a maximum word size threshold defined in the preset row spacing configuration set; If the current font size parameter is smaller than or equal to the minimum font size threshold, taking a minimum line space value corresponding to the minimum font size threshold as the target line space value; And if the current font size parameter is greater than or equal to the maximum font size threshold, taking the maximum line space value corresponding to the maximum font size threshold as the target line space value.
  6. 6. The method of claim 5, wherein the performing a matching lookup in a preset row spacing configuration set to obtain a target row spacing value further comprises: and if the current font size parameter is between the minimum font size threshold and the maximum font size threshold and the accurate matched font size is not found in the line space configuration set, taking a preset general default line space value as the target line space value.
  7. 7. The method according to claim 1, wherein the method further comprises: Acquiring the number of semantic types in the row spacing configuration set; and generating an input interface according to the number of the semantic types, wherein the input interface is used for selecting the semantic types.
  8. 8. The method of claim 1, wherein the attribute information further comprises visual style characteristics of the target text object, the visual style characteristics including at least a stroked or projected line space configuration set further comprising identifiers corresponding to different visual style characteristics and line space compensation values thereof; Before the step of applying the target line space value to the rendering attribute of the target text object, the method further includes: And searching a corresponding line space compensation value in a line space configuration set according to an identifier corresponding to the visual style characteristic of the target text object, and correcting the target line space value through the line space compensation value.
  9. 9. The method of claim 1, wherein said applying the target line space value to the rendering properties of the target text object comprises: intercepting in a grid generation stage of the target text object; calculating the vertical displacement of each grid vertex in the target text object according to the target row spacing value; And modifying coordinates of each grid vertex in the target text object according to the vertical displacement to adjust row spacing layout properties of the target text object.
  10. 10. The method according to claim 1, wherein the method further comprises: and reloading the row spacing configuration set in response to the change of the preset row spacing configuration set, and triggering the rendering attribute refreshing of the target text object under the condition of keeping the content of the target text object unchanged.
  11. 11. A text line spacing configuration device, the device comprising: the acquisition module is used for acquiring attribute information of a target text object, wherein the attribute information comprises a semantic type corresponding to the target text object and a current font size parameter; The searching module is used for carrying out matching searching in a preset line space configuration set according to the semantic type and the current font size parameter to obtain a target line space value; And the application module is used for applying the target line space value to the rendering attribute of the target text object so as to control the line space layout attribute of the target text object.
  12. 12. An electronic device, comprising: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the text line space configuration method of any one of claims 1 to 10.
  13. 13. A computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the text line spacing configuration method of any one of claims 1 to 10.

Description

Text line space configuration method, device, equipment and storage medium Technical Field The disclosure relates to the technical field of computer graphics, in particular to a text line space configuration method, a device, equipment and a storage medium. Background In the graphical user interface design and development process, text line spacing is a key attribute that affects the reading experience and visual hierarchy. In the related art, text line spacing is generally regarded as an independent visual parameter, and is manually set or simply globally uniformly set in an editor for each text component by a developer. However, this conventional arrangement has significant limitations. Because the semantic types (such as titles, texts, notes and the like) of the text objects and the difference of font sizes on line space requirements are ignored, developers often need to set repeated numerical values for a large number of texts with different word sizes and different purposes, so that the workload is high, the efficiency is low, and the line space standards of the same type of semantic or the same word size are difficult to ensure to be uniform. Therefore, a text line space configuration method is needed to solve the problems of low text line space configuration efficiency and poor interface display standardization in the related art. Disclosure of Invention The disclosure provides a text line space configuration method, a device, equipment and a storage medium, which are used for solving the problems of low text line space configuration efficiency and poor interface display standardization in the related technology. In a first aspect, the present disclosure provides a text line space configuration method, the method including: acquiring attribute information of a target text object, wherein the attribute information comprises a semantic type corresponding to the target text object and a current font size parameter; According to the semantic type and the current font size parameter, matching and searching are carried out in a preset line space configuration set to obtain a target line space value; The target line space value is applied to the rendering attribute of the target text object to control the line space layout attribute of the target text object. According to the text line space configuration method, the semantic type (such as title and text) of the target text object and the current font size parameter are obtained, matching search is carried out in a preset line space configuration set by utilizing the two attributes to determine the target line space value, and finally the target line space value is applied to the rendering attribute. The method has the advantages that a mapping mechanism of semantics and line spacing is established, and the line spacing data and the semantic purpose of the text are directly bound, so that when the word size of the text changes or the semantic roles of the text change, the line spacing meeting the preset typesetting specification can be automatically adapted, the workload of manual repeated configuration is effectively eliminated, the text under the same semantic type is ensured to always maintain the uniform typesetting visual standard under different word sizes, and the configuration efficiency and standardization of interface development are remarkably improved. In an alternative embodiment, before the step of performing the matching lookup in the preset row spacing configuration set, the method further includes: judging whether a preset custom line distance value exists in the target text object or not; if the custom line space value exists, determining the custom line space value as a target line space value, and skipping the step of matching and searching in a preset line space configuration set; if the custom row spacing value does not exist, executing the step of matching and searching in the preset row spacing configuration set. The method and the device have the advantages that the overall automatic configuration efficiency is ensured, meanwhile, the flexibility of manual intervention is reserved, a developer can conduct fine adjustment aiming at special scenes (such as artistic words or specific formats), and the problem that the full-automatic mechanism is too stiff to meet personalized typesetting requirements is avoided. In an alternative embodiment, the preset row spacing configuration set includes a plurality of sub-configuration tables aiming at different semantic types and a global default configuration table, and the matching search is performed in the preset row spacing configuration set to obtain a target row spacing value, including: screening out a corresponding target sub-configuration table in the row spacing configuration set according to the semantic type; Searching a first row spacing value matched with the current font size parameter in a target sub-configuration table, and determining the first row spacing value as a target row