CN110321124B - Text layout optimization method and device and electronic equipment - Google Patents

Text layout optimization method and device and electronic equipment Download PDF

Info

Publication number
CN110321124B
CN110321124B CN201910538164.2A CN201910538164A CN110321124B CN 110321124 B CN110321124 B CN 110321124B CN 201910538164 A CN201910538164 A CN 201910538164A CN 110321124 B CN110321124 B CN 110321124B
Authority
CN
China
Prior art keywords
text layout
target
layout
adjacent data
pair
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910538164.2A
Other languages
Chinese (zh)
Other versions
CN110321124A (en
Inventor
李开开
苏同乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201910538164.2A priority Critical patent/CN110321124B/en
Publication of CN110321124A publication Critical patent/CN110321124A/en
Application granted granted Critical
Publication of CN110321124B publication Critical patent/CN110321124B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/106Display of layout of documents; Previewing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/109Font handling; Temporal or kinetic typography
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Artificial Intelligence (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The embodiment of the invention provides a text layout optimization method, a text layout optimization device and electronic equipment, wherein the method comprises the following steps: acquiring a pre-established target deviation mapping table; the target deviation mapping table comprises deviation amounts of a preset text layout of the design draft and a display text layout which is displayed on the designated equipment after the preset text layout is rendered; in the target deviation mapping table, inquiring deviation amounts of a preset text layout and a display text layout, and correcting parameter values of corresponding parameters in a target code program according to the deviation amounts to obtain parameters of the target text layout; and rendering according to the parameters of the target text layout, so that the target display text layout corresponding to the parameters of the target text layout is displayed on the specified equipment. The invention realizes convenient and rapid adjustment of the difference between the displayed text layout and the preset text layout, so that the final displayed text layout is consistent with the text layout required by design.

Description

Text layout optimization method and device and electronic equipment
Technical Field
The invention relates to the technical field of computers, in particular to a text layout optimization method and device and electronic equipment.
Background
In the text display technology, a text layout to be displayed, including a font style, a font size, a space, a text typesetting mode, and the like, may be set on a design document in advance to form a preset text layout, and then the preset text layout is rendered and displayed on a designated device (e.g., a mobile phone) to form a display text layout. Specifically, a User Interface (UI) designer may label each data block using a Photoshop graphics processing software. For example, the font size of the text font of the label text, the position of each data block, the distance between adjacent data blocks and the like, and a preset text layout is formed; and adding a text container to each data block and compiling codes for rendering output by a program developer according to the numerical values marked in the preset text layout to obtain the display text layout.
However, when a text container is added to each data block, a transparent frame is added to each data block, which results in that the distance between adjacent data blocks displayed in the displayed text layout is greater than the actual labeled distance, and the displayed text layout cannot be completely consistent with the preset text layout.
In view of the above problems, under the condition of strict layout requirements, program developers and UI designers are required to perform parameter correction and display acceptance for many times, which wastes manpower and is inefficient. Therefore, how to conveniently and quickly adjust the difference between the displayed text layout and the preset text layout so as to finally obtain the display effect consistent with the design requirement is still a technical problem to be solved urgently.
Disclosure of Invention
The embodiment of the invention aims to provide a text layout optimization method, a text layout optimization device and electronic equipment, so that the difference between a displayed text layout and a preset text layout can be conveniently and quickly adjusted, and the text layout displayed on the designated equipment is consistent with the text layout required by design. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention discloses a text layout optimization method, where the method includes:
acquiring a pre-established target deviation mapping table; the target deviation mapping table comprises a deviation amount between a preset text layout of the design draft and a display text layout which is rendered and then displayed on the designated equipment;
in the target deviation mapping table, inquiring the deviation amount between the preset text layout and the display text layout, and correcting the parameter value of the corresponding parameter in the target code program according to the deviation amount to obtain the parameter of the target text layout;
rendering according to the parameters of the target text layout, so that a display text layout corresponding to the parameters of the target text layout is displayed on the designated equipment.
Optionally, the step of establishing the target deviation mapping table includes:
acquiring each text layout pair of different font sizes; aiming at any text layout pair, the text layout pair comprises a preset text layout and a display text layout of a font size corresponding to the text layout pair, and the display text layout is a text layout which is actually displayed after specified data are rendered according to the preset text layout;
respectively acquiring a first distance between every two adjacent data blocks in a preset text layout of every text layout pair;
respectively acquiring a second distance between every two adjacent data blocks in the displayed text layout of every text layout pair;
and respectively calculating the deviation amount of the first space and the second space of each same adjacent data block of each text layout pair, and storing the deviation amount of each adjacent data block of each text layout pair to obtain a target deviation mapping table.
Optionally, when the object code program is a compiler program of a program developer, the querying, in the object deviation mapping table, a deviation amount between the preset text layout and the display text layout, and correcting a parameter value of a corresponding parameter in the object code program according to the deviation amount to obtain a parameter of the object text layout includes:
inquiring a target text layout pair which has the same font size and layout as the preset text layout and the display text layout in the target deviation mapping table;
respectively determining adjacent data blocks in the target text layout pair corresponding to each adjacent data block in the compiler;
for each pair of adjacent data blocks in the compiler, according to the deviation amount of the adjacent data blocks in the target text layout pair corresponding to the adjacent data blocks, reducing the text container distance of the adjacent data blocks;
and determining the text parameters after the text container space of each adjacent data block is adjusted as the parameters of the target text layout.
Optionally, when the target code program is a design program of a user interface designer, the step of querying, in the target deviation mapping table, a deviation amount between the preset text layout and the display text layout, and correcting a parameter value of a corresponding parameter in the target code program according to the deviation amount to obtain a parameter of the target text layout includes:
inquiring a target text layout pair which has the same font size and layout as the preset text layout and the display text layout in the target deviation mapping table;
respectively determining adjacent data blocks in the target text layout pair corresponding to each adjacent data block in a design program of the user interface designer;
for each pair of adjacent data blocks in the design program of the user interface designer, reducing the labeling distance of the adjacent data blocks according to the deviation amount of the adjacent data blocks in the target text layout pair corresponding to the adjacent data blocks;
and determining the text parameters after the marking intervals of the adjacent data blocks are adjusted as the parameters of the target text layout.
In a second aspect, an embodiment of the present invention discloses a text layout optimization apparatus, where the apparatus includes:
the target deviation mapping table acquisition module is used for acquiring a pre-established target deviation mapping table; the target deviation mapping table comprises a deviation amount between a preset text layout of a design draft and a display text layout which is rendered and then displayed on designated equipment;
the deviation amount correction module is used for inquiring the deviation amount between the preset text layout and the display text layout in the target deviation mapping table, and correcting the parameter value of the corresponding parameter in the target code program according to the deviation amount to obtain the parameter of the target text layout;
and the display text layout display module is used for rendering according to the parameters of the target text layout so as to display the display text layout corresponding to the parameters of the target text layout on the specified equipment.
Optionally, the apparatus further comprises:
the text layout pair acquisition module is used for acquiring each text layout pair of different font sizes; aiming at any text layout pair, the text layout pair comprises a preset text layout and a display text layout of a font size corresponding to the text layout pair, and the display text layout is a text layout which is actually displayed after specified data are rendered according to the preset text layout;
a first interval obtaining module, configured to obtain a first interval between each adjacent data block in a preset text layout of each text layout pair;
a second distance obtaining module, configured to obtain a second distance between each adjacent data block in the displayed text layout of each text layout pair;
and the target deviation mapping table establishing module is used for respectively calculating the deviation amount of the first space and the second space of each same adjacent data block of each text layout pair, storing the deviation amount of each adjacent data block of each text layout pair and obtaining the target deviation mapping table.
Optionally, when the object code program is a compiler of a program developer, the deviation amount correction module includes:
a first target text layout pair determining submodule, configured to query, in the target deviation mapping table, a target text layout pair that is the same as the preset text layout and the display text layout in font and font size and has the same layout;
a first adjacent data block determination submodule, configured to determine adjacent data blocks in the target text layout pair corresponding to each adjacent data block in the compiler;
a text container interval adjusting submodule, configured to, for each pair of adjacent data blocks in the compiler, decrease a text container interval of the adjacent data block according to a deviation amount of the adjacent data block in the target text layout pair corresponding to the adjacent data block;
and the first target text layout parameter determining submodule is used for determining the text parameter after the text container spacing of each adjacent data block is adjusted as the parameter of the target text layout.
Optionally, when the object code program is a design program of a user interface designer, the deviation amount correction module includes:
a second target text layout pair determining submodule, configured to query, in the target deviation mapping table, a target text layout pair that is the same as the preset text layout and the display text layout in font size and layout;
a second adjacent data block determination submodule, configured to determine, respectively, adjacent data blocks in the target text layout pair that correspond to each adjacent data block in a design program of the user interface designer;
a marking distance adjusting submodule, configured to, for each pair of adjacent data blocks in the design program of the user interface designer, reduce a marking distance of the adjacent data block according to a deviation amount of the adjacent data block in the target text layout pair corresponding to the adjacent data block;
and the second target text layout parameter determining submodule is used for determining the text parameter after the marking distance of each adjacent data block is adjusted as the parameter of the target text layout.
In a third aspect, an embodiment of the present invention discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the method steps of any of the above text layout optimization methods when executing the program stored in the memory.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions which, when executed on a computer, implement the method steps of any one of the above-described text layout optimization methods.
In yet another aspect of the present invention, an embodiment of the present invention further provides a computer program product containing instructions, which when run on a computer, implement the method steps in any one of the above text layout optimization methods.
The embodiment of the invention provides a text layout optimization method, a text layout optimization device and electronic equipment. The embodiment of the invention changes the condition that the former developer frequently changes the numerical value to accurately adapt to the preset text layout, realizes the one-time correction of the text layout code, and conveniently and quickly adjusts the text layout, so that the layout effect consistent with the text layout required by the design is displayed on the appointed equipment.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below.
FIG. 1 is a flowchart of a text layout optimization method according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for creating a target deviation implicit table in a text layout optimization method according to an embodiment of the present invention;
fig. 3 is a flowchart of a method for determining parameters of a target display text layout in a text layout optimization method according to an embodiment of the present invention;
FIG. 4 is a system framework diagram of a text layout optimization method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a text layout optimization apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
In a first aspect, an embodiment of the present invention discloses a text layout optimization method, as shown in fig. 1. Fig. 1 is a flowchart of a text layout optimization method according to an embodiment of the present invention, where the method includes:
s101, acquiring a pre-established target deviation mapping table; the target deviation mapping table comprises deviation amounts of a preset text layout of the design draft and a display text layout which is displayed on the designated equipment after the preset text layout is rendered.
In the embodiment of the invention, in order to simplify the correction operation of programmers and UI designers, a target deviation mapping table of the corresponding relation between the preset text layout and the display text layout is established in advance. The specific setup procedure is detailed in the following examples. The optimization method provided by the embodiment of the invention can be applied to an IOS (input/output system), an android system and the like with deviation between any preset text layout and a display text layout displayed on the designated equipment after rendering the preset text layout, or is applied to mobile phone software and the like with deviation between any preset text layout and a display text layout displayed on the designated equipment after rendering the preset text layout. Wherein the designated device may be a mobile device, such as a cell phone, tablet, etc.
In the embodiment of the invention, in order to realize deviation correction of the preset text layout and the display text layout in the same layout form (the font and the font size are the same at the same position), the target deviation mapping table can be uploaded to the cloud in advance. In this step, the target deviation mapping table may be downloaded in the cloud server or any database of any storage server according to the file name.
S102, in the target deviation mapping table, the deviation amount of the preset text layout and the display text layout is inquired, and the parameter value of the corresponding parameter in the target code program is corrected according to the deviation amount to obtain the parameter of the target text layout.
The correction mode of the embodiment of the invention can be divided into two modes, one mode is to correct the parameters in the compiler of the program developer, so that the rendering is carried out according to the corrected parameters for displaying the text layout, and the layout effect consistent with the design requirement is obtained; and the other is to correct the design program of the user interface designer, so that rendering is carried out according to the corrected parameters of the preset text layout to obtain a layout effect consistent with the design requirement.
In this step, a preset text layout and a display text layout corresponding to the preset text handling layout can be used as a text layout pair, a target text layout pair which is the same as the font size and layout of the text layout pair is searched in a target deviation mapping table according to the font size and layout of the text layout pair, and then the distance between adjacent data blocks in a design program of a user interface designer corresponding to the preset text layout is reduced at one time or the distance between adjacent data block text containers in a compiler corresponding to the display text layout is reduced at one time according to the deviation amount of each pair of adjacent data blocks recorded by the target text layout pair. And taking the corrected text layout parameter as a target text layout parameter.
S103, rendering the parameters of the target text layout, so that the display text layout corresponding to the parameters of the target text layout is displayed on the specified equipment.
In the step, when the current adjustment is the compiler of the program developer, rendering the adjusted compiler to obtain a display file layout consistent with the design requirement layout; and when the current adjusted design program is the design program of the user interface designer, recoding and rendering are carried out according to the adjusted design program to obtain the display file layout consistent with the layout of the design draft.
In the text layout optimization method of the embodiment of the invention, a target deviation mapping table of deviation amounts of a preset text layout and a display text layout is used for directly searching existing deviation amounts in the target deviation mapping table, parameter values of corresponding parameters in a target code program are corrected according to the deviation amounts to obtain a target text layout, and then rendering is carried out according to the parameters of the target display text layout, so that the display text layout corresponding to the parameters of the target text layout is displayed on a designated device. The embodiment of the invention changes the condition that the former developer frequently changes the numerical value to accurately adapt to the preset text layout, realizes the one-time correction of the text layout code, and conveniently and quickly adjusts the text layout, so that the layout effect consistent with the text layout required by the design is displayed on the appointed equipment.
Alternatively, in an embodiment of the text layout optimization method of the present invention, the step of establishing the target deviation mapping table may be as shown in fig. 2. Fig. 2 is a flowchart of a method for establishing a target deviation implicit table in a text layout optimization method according to an embodiment of the present invention, including:
s201, obtaining each text layout pair of different font sizes; and aiming at any text layout pair, the text layout pair comprises a preset text layout and a display text layout of the font size corresponding to the text layout pair, and the display text layout is the text layout which is actually displayed after the designated data is rendered according to the preset text layout.
In the embodiment of the invention, each preset text layout with the same layout form and different font sizes can be pre-established, a text container and an execution code are added to each data block according to the parameter values marked in the preset text layout, rendering is completed on a designated device to obtain the display text layout corresponding to each preset text layout, and the preset text layout and the display text layout corresponding to the preset text layout form a text layout pair.
The preset text layout can divide the display page into a plurality of areas according to the design requirements of a user, and each area is added with corresponding data information to form each data block. The font size of each data block, the typesetting inside each data block and the typesetting among the data blocks are marked in the preset text layout, the position of each data block is determined, the relative position of each data block is also determined, and the distance between every two adjacent data blocks is marked in the preset text layout.
And compiling the program by a program developer according to the layout of the preset text layout and the labeled value, and rendering on the specified equipment to obtain the display text layout. It can be known that the position of each data block and the relative position of each data block in the displayed text layout are consistent with the preset text layout, and what is inconsistent is that a transparent frame is added to each data block in the compiling process, so that the space between every two adjacent data blocks in the displayed text layout obtained by rendering according to the space marked by the preset text layout is increased. In this embodiment, deviation amounts of a preset text layout and a display text layout with the same type and size in different fonts are pre-established, the deviation amounts are recorded to form a target deviation mapping table, and the target deviation mapping table is pre-stored as a database for subsequent adjustment by implementers.
S202, respectively obtaining a first distance between every two adjacent data blocks in the preset text layout of every text layout pair.
In this step, for the text layout pair, a first distance between each adjacent data in a preset text layout in the text layout pair may be obtained first. Specifically, each two adjacent data blocks may be obtained from left to right and from top to bottom. And obtaining the first distance between every two adjacent data blocks according to the numerical value marked by the preset text layout.
S203, respectively obtaining a second distance between every two adjacent data blocks in the display text layout of every text layout pair.
In this step, for the text layout pair, a second distance between each adjacent data in the text layout displayed in the text layout pair may be obtained. The second pitches of the same adjacent data blocks may be obtained in the order in which the first pitches are obtained according to the preset text layout.
In the embodiment of the present invention, a second distance between every two adjacent data blocks in a displayed text layout of a text layout pair may be obtained first, and a first distance between every two adjacent data blocks in a preset text layout of the text layout pair is obtained; or simultaneously acquiring a first distance between every two adjacent data blocks in a preset text layout of the text layout pair and a second distance between every two adjacent data blocks in a display text layout, wherein the specific sequence is not limited.
And acquiring a first interval between every two adjacent data blocks in the preset text layout in each data pair and a second interval between every two adjacent data blocks in the display text layout according to the mode.
S204, respectively calculating the deviation amount of the first space and the second space of each same adjacent data block of each text layout pair, and storing the deviation amount of each adjacent data block of each text layout pair to obtain a target deviation mapping table.
For each text layout pair, the deviation amount of the first spacing and the second spacing of each two adjacent data blocks can be calculated from left to right and from top to bottom, and then the deviation amount is correctly stored at the deviation position of the adjacent data block according to the position of the database in the text layout. Or storing the number of the adjacent data block and the deviation amount of the adjacent data block in a preset table according to the number of the data block.
It should be noted that, the target deviation mapping table may further increase the deviation amount of other entries, such as the deviation amount of the indentation before the segment and the indentation after the segment, and specifically may determine the parameter and the parameter deviation amount that need to be adjusted according to the actual precise condition and the rendering technology.
Therefore, the embodiment of the invention can be used for pre-establishing the deviation corresponding relation of the preset text layout and the display text layout to obtain the target deviation mapping table. The target offset mapping table may facilitate an implementer to find the corresponding offset.
Optionally, in an embodiment of the text layout optimization method of the present invention, when the object code program is a compiler of a program developer, in S102, the parameter value of the corresponding parameter in the object code program is corrected according to the margin deviation and the pitch deviation to obtain the parameter of the target text layout, which may be shown in fig. 3 as a flowchart of a method for determining the parameter of the target text layout in the text layout optimization method of the embodiment of the present invention, including:
s301, searching a target text layout pair which has the same font size and layout as the preset text layout and the display text layout in the target deviation mapping table.
In this step, according to the font size and layout of the preset text layout, the preset text layout which is the same as the font size and layout is searched in the target deviation mapping table, and the text layout pair corresponding to the preset text layout is determined as the target text layout pair.
Or according to the font size and the layout of the display text layout, searching the display text layout which is the same as the font size and the layout in the target deviation mapping table, and determining the text layout pair corresponding to the display text layout as the target text layout pair.
S302, adjacent data blocks in the target text layout pair corresponding to the adjacent data blocks in the compiler program are respectively determined.
The adjacent data blocks in the target text layout pair corresponding to every two adjacent data blocks in the compiler can be determined according to the sequence from left to right and from top to bottom; or according to the number of the data block, determining the adjacent data block with the same number in the target text layout pair corresponding to the number of the adjacent data block in the compiler.
And S303, aiming at each pair of adjacent data blocks in the compiler, according to the deviation amount of the adjacent data blocks in the target text layout pair corresponding to the adjacent data blocks, reducing the text container distance of the adjacent data blocks.
The UI designer uses Photoshop to obtain the labeling data of the preset text layout, wherein the preset text layout is the labeling data of the font, the font size and the distance between the adjacent data blocks, and when a program developer compiles a program according to the labeling data, the program developer uses a text container to compile each data block, so that a transparent frame is added to each data block, the distance between the adjacent data blocks displaying the text layout is slightly larger than the distance between the adjacent data blocks in the design requirement, and the distance between the text containers of the adjacent data blocks can be reduced in the embodiment. In this embodiment, the distance between the text containers of the adjacent data blocks in the compiler is adjusted to render according to the corrected parameters of the displayed text layout, so as to obtain a layout effect consistent with the layout required by the design.
Therefore, in this step, the distance between the text containers of adjacent data blocks in the compiler is reduced by the corresponding deviation amount according to the deviation amount recorded in the target deviation map.
S304, determining the text parameters after the text container space of each adjacent data block is adjusted as the parameters of the target text layout.
Therefore, the compiling program of the program developer can be corrected at one time, the display text layout is conveniently and quickly adjusted, the rendering is carried out according to the adjusted display text layout, and the layout effect consistent with the text layout required by the design is displayed on the specified equipment.
Optionally, in an embodiment of the text layout optimization method of the present invention, when the object code program is a design program of a user interface designer, obtaining parameters of the target text layout according to the edge distance deviation and parameter values of corresponding parameters in the object code program of the distance deviation in S102 includes:
step one, searching a target text layout pair which has the same font size and layout as the preset text layout and the display text layout in a target deviation mapping table.
In this step, according to the font size and layout of the preset text layout, the preset text layout which is the same as the font size and layout is searched in the target deviation mapping table, and the text layout pair corresponding to the preset text layout is determined as the target text layout pair.
Or according to the font size and layout of the display text layout, searching the display text layout which is the same as the font size and layout in the target deviation mapping table, and determining the text layout pair corresponding to the display text layout as the target text layout pair.
And step two, respectively determining adjacent data blocks in the target text layout pair corresponding to each adjacent data block in the design program of the user interface designer.
The method comprises the steps that adjacent data blocks in a target text layout pair corresponding to every two adjacent data blocks in the design program of a user interface designer can be determined according to the sequence from left to right and from top to bottom; or according to the number of the data block, determining the adjacent data block with the same number in the target text layout pair corresponding to the number of the adjacent data block in the design program of the user interface designer.
And thirdly, aiming at each pair of adjacent data blocks in the design program of the user interface designer, and according to the deviation value of the adjacent data blocks in the target text layout pair corresponding to the adjacent data blocks, reducing the labeling space of the adjacent data blocks.
According to the size of characters required by a design draft, a design program of a UI designer uses Photoshop to obtain labeled data of a preset text layout, wherein the preset text layout is the labeled text font, the font size and the space between adjacent data blocks. In this embodiment, the rendering according to the corrected parameters of the preset text layout is realized by adjusting the label distance between adjacent data blocks in the design program of the user interface designer, so as to obtain a layout effect consistent with the layout required by the design.
Therefore, in this step, according to the deviation amount recorded in the target deviation mapping table, the labeling distance between adjacent data blocks in the design program of the user interface designer is adjusted to be smaller by the corresponding deviation amount.
And step four, determining the text parameters after the label spacing of each adjacent data block is adjusted as the parameters of the target text layout.
Therefore, the embodiment of the invention can realize the one-time correction of the design program of the user interface designer, conveniently and quickly adjust the preset text layout, so that the compiling and the rendering are carried out according to the adjusted preset text layout, and finally the layout effect consistent with the text layout required by the design is displayed on the designated equipment.
To better illustrate the text layout optimization method according to the embodiment of the present invention, there may be a system framework diagram of the text layout optimization method according to the embodiment of the present invention shown in fig. 4.
In the embodiment of the invention, the target deviation mapping table can be uploaded to the cloud in advance. When a display text layout needs to be obtained on an IOS development device (e.g., a mobile phone), a target deviation mapping table can be downloaded at the cloud, a target text layout pair which has the same font size and layout mode as the preset text layout at this time is searched in the target deviation mapping table, and then the preset text layout or the display text layout is corrected according to the deviation amount of the preset text layout and the display text layout recorded in the target text layout pair, so that a layout effect which is consistent with the text layout required by design is displayed on the IOS development device according to the adjusted text layout.
In a second aspect, an embodiment of the present invention discloses a text layout optimization apparatus, as shown in fig. 5. Fig. 5 is a schematic structural diagram of a text layout optimization apparatus according to an embodiment of the present invention, where the apparatus includes:
a target deviation mapping table obtaining module 501, configured to obtain a pre-established target deviation mapping table; the target deviation mapping table comprises a deviation amount between a preset text layout of the design draft and a display text layout which is displayed on the designated equipment after the preset text layout is rendered;
a deviation amount correction module 502, configured to query, in the target deviation mapping table, a deviation amount between a preset text layout and a display text layout, and correct a parameter value of a corresponding parameter in the target code program according to the deviation amount to obtain a parameter of the target text layout;
and a target display text layout display module 503, configured to render according to the parameters of the target text layout, so that a display text layout corresponding to the parameters of the target text layout is displayed on the specified device.
In the text layout optimization apparatus provided in the embodiment of the present invention, by presetting a target deviation mapping table of deviation amounts of a text layout and a display text layout, an existing deviation amount is directly searched in the target deviation mapping table, a parameter value of a corresponding parameter in a target code program is corrected according to the deviation amount to obtain a target text layout, and then rendering is performed according to a parameter of the target display text layout, so that the display text layout corresponding to the parameter of the target text layout is displayed on a designated device. The embodiment of the invention changes the condition that the former developer frequently changes the numerical value to accurately adapt to the preset text layout, realizes the one-time correction of the text layout code, and conveniently and quickly adjusts the text layout, so that the layout effect consistent with the text layout required by the design is displayed on the appointed equipment.
Optionally, in an embodiment of the text layout optimizing apparatus of the present invention, the apparatus further includes:
the text layout pair acquisition module is used for acquiring each text layout pair of different font sizes; aiming at any text layout pair, the text layout pair comprises a preset text layout and a display text layout of a font character size corresponding to the text layout pair, and the display text layout is a text layout which is actually displayed after specified data are rendered according to the preset text layout;
the first space acquisition module is used for respectively acquiring the first space of each adjacent data block in the preset text layout of each text layout pair;
the second distance acquisition module is used for respectively acquiring a second distance between every two adjacent data blocks in the display text layout of every text layout pair;
and the target deviation mapping table establishing module is used for respectively calculating the deviation amount of the first spacing and the second spacing of each same adjacent data block of each text layout pair, storing the deviation amount of each adjacent data block of each text layout pair and obtaining the target deviation mapping table.
Optionally, in an embodiment of the text layout optimization apparatus of the present invention, when the object code program is a compiler program of a program developer, the deviation amount correction module 502 includes:
the first target text layout pair determining submodule is used for inquiring a target text layout pair which has the same font size and layout as the preset text layout and the display text layout in a target deviation mapping table;
the first adjacent data block determining submodule is used for respectively determining adjacent data blocks in a target text layout pair corresponding to each adjacent data block in the compiler;
the text container spacing adjusting submodule is used for adjusting the text container spacing of each pair of adjacent data blocks in the compiler according to the deviation value of the adjacent data blocks in the target text layout pair corresponding to the adjacent data blocks;
and the first target text layout parameter determining submodule is used for determining the text parameter after the text container spacing of each adjacent data block is adjusted as the parameter of the target text layout.
Alternatively, in an embodiment of the text layout optimization apparatus according to the present invention, when the object code program is a design program of a user interface designer, the deviation amount correction module 502 includes:
a second target text layout pair determining submodule, configured to query, in the target deviation mapping table, a target text layout pair that is the same as the preset text layout and the font size of the displayed text layout and has the same layout;
the second adjacent data block determining submodule is used for respectively determining adjacent data blocks in the target text layout pair corresponding to each adjacent data block in the design program of the user interface designer;
the marking distance adjusting submodule is used for reducing the marking distance of each pair of adjacent data blocks in the design program of the user interface designer according to the deviation amount of the adjacent data blocks in the target text layout pair corresponding to the adjacent data blocks;
and the second target text layout parameter determining submodule is used for determining the text parameters after the labeling space of each adjacent data block is adjusted as the parameters of the target text layout.
In a third aspect, an embodiment of the present invention discloses an electronic device, as shown in fig. 6. Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, which includes a processor 601, a communication interface 602, a memory 603, and a communication bus 604, where the processor 601, the communication interface 602, and the memory 603 complete communication with each other through the communication bus 604;
a memory 603 for storing a computer program;
the processor 601 is configured to implement any method step of the text layout optimization method when executing the program stored in the memory.
The communication bus 604 mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 604 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this is not intended to represent only one bus or type of bus.
The communication interface 602 is used for communication between the above-described electronic apparatus and other apparatuses.
The Memory 603 may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory 603 may also be at least one storage device located remotely from the processor 601.
The Processor 601 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, or discrete hardware components.
In the electronic device provided by the embodiment of the present invention, a target deviation mapping table of deviation amounts of a text layout and a display text layout is preset, an existing deviation amount is directly searched in the target deviation mapping table, a parameter value of a corresponding parameter in a target code program is corrected according to the deviation amount to obtain a target text layout, and then rendering is performed according to the parameter of the target display text layout, so that the display text layout corresponding to the parameter of the target text layout is displayed on a designated device. The embodiment of the invention changes the condition that the former developer frequently changes the numerical value to accurately adapt to the preset text layout, realizes the one-time correction of the text layout code, and conveniently and quickly adjusts the text layout, so that the layout effect consistent with the text layout required by the design is displayed on the appointed equipment.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions which, when run on a computer, implement any one of the above-described text layout optimization methods.
In a computer-readable storage medium provided in an embodiment of the present invention, a target deviation mapping table of deviation amounts of a text layout and a display text layout is preset, an existing deviation amount is directly searched in the target deviation mapping table, a parameter value of a corresponding parameter in a target code program is corrected according to the deviation amount to obtain a target text layout, and rendering is performed according to the parameter of the target display text layout, so that the display text layout corresponding to the parameter of the target text layout is displayed on a designated device. The embodiment of the invention changes the condition that the former developer frequently changes the numerical value to accurately adapt to the preset text layout, realizes the one-time correction of the text layout code, and conveniently and quickly adjusts the text layout, so that the layout effect consistent with the text layout required by the design is displayed on the appointed equipment.
In another aspect of the present invention, an embodiment of the present invention further provides a computer program product containing instructions, which when run on a computer, implement any one of the above-mentioned text layout optimization methods.
In a computer program product including instructions provided in an embodiment of the present invention, a target deviation mapping table of deviation amounts of a preset text layout and a display text layout is used to directly find an existing deviation amount in the target deviation mapping table, and a parameter value of a corresponding parameter in a target code program is corrected according to the deviation amount to obtain a target text layout, and then rendering is performed according to the parameter of the target display text layout, so that the display text layout corresponding to the parameter of the target text layout is displayed on a designated device. The embodiment of the invention changes the condition that the former developer frequently changes the numerical value to accurately adapt to the preset text layout, realizes the one-time correction of the text layout code, and conveniently and quickly adjusts the text layout, so that the layout effect consistent with the text layout required by the design is displayed on the appointed equipment.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions according to the embodiments of the invention are brought about in whole or in part when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the embodiments of the apparatus and the electronic device, since they are substantially similar to the embodiments of the method, the description is simple, and reference may be made to the partial description of the embodiments of the method for relevant points.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A method for optimizing a layout of text, the method comprising:
acquiring a pre-established target deviation mapping table; the target deviation mapping table comprises a deviation amount between a preset text layout of the design draft and a display text layout which is rendered and then displayed on the designated equipment;
in the target deviation mapping table, inquiring the deviation amount between the preset text layout and the display text layout, and correcting the parameter value of the corresponding parameter in the target code program according to the deviation amount to obtain the parameter of the target text layout;
rendering according to the parameters of the target text layout, so that a display text layout corresponding to the parameters of the target text layout is displayed on the specified equipment.
2. The method of claim 1, wherein the step of building the target skew map comprises:
acquiring each text layout pair of different font sizes; aiming at any text layout pair, the text layout pair comprises a preset text layout and a display text layout of a font size corresponding to the text layout pair, and the display text layout is a text layout which is actually displayed after specified data are rendered according to the preset text layout;
respectively acquiring a first distance between every two adjacent data blocks in the preset text layout of every text layout pair;
respectively acquiring a second distance between every two adjacent data blocks in the display text layout of every text layout pair;
and respectively calculating the deviation amount of the first space and the second space of each same adjacent data block of each text layout pair, and storing the deviation amount of each adjacent data block of each text layout pair to obtain a target deviation mapping table.
3. The method according to claim 2, wherein when the object code program is a compiler of a program developer, the querying a deviation amount between the preset text layout and the display text layout in the object deviation mapping table, and correcting a parameter value of a corresponding parameter in the object code program according to the deviation amount to obtain a parameter of the object text layout includes:
inquiring a target text layout pair which has the same font size and layout as the preset text layout and the display text layout in the target deviation mapping table;
respectively determining adjacent data blocks in the target text layout pair corresponding to each adjacent data block in the compiler;
for each pair of adjacent data blocks in the compiler, according to the deviation amount of the adjacent data blocks in the target text layout pair corresponding to the adjacent data blocks, reducing the text container distance of the adjacent data blocks;
and determining the text parameters after the text container space of each adjacent data block is adjusted as the parameters of the target text layout.
4. The method according to claim 2, wherein when the object code program is a design program of a user interface designer, the querying, in the object deviation mapping table, a deviation amount between the preset text layout and the display text layout, and correcting a parameter value of a corresponding parameter in the object code program according to the deviation amount to obtain a parameter of the target text layout comprises:
inquiring a target text layout pair which has the same font size and layout as the preset text layout and the display text layout in the target deviation mapping table;
respectively determining adjacent data blocks in the target text layout pair corresponding to each adjacent data block in a design program of the user interface designer;
for each pair of adjacent data blocks in the design program of the user interface designer, reducing the labeling distance of the adjacent data blocks according to the deviation amount of the adjacent data blocks in the target text layout pair corresponding to the adjacent data blocks;
and determining the text parameters after the marking intervals of the adjacent data blocks are adjusted as the parameters of the target text layout.
5. A text layout optimization apparatus, the apparatus comprising:
the target deviation mapping table acquisition module is used for acquiring a pre-established target deviation mapping table; the target deviation mapping table comprises a deviation amount between a preset text layout of the design draft and a display text layout which is rendered and then displayed on the designated equipment;
the deviation amount correction module is used for inquiring the deviation amount between the preset text layout and the display text layout in the target deviation mapping table, and correcting the parameter values of the corresponding parameters in the target code program according to the deviation amount to obtain the parameters of the target text layout;
and the display text layout display module is used for rendering according to the parameters of the target text layout, so that the display text layout corresponding to the parameters of the target text layout is displayed on the specified equipment.
6. The apparatus of claim 5, further comprising:
the text layout pair acquisition module is used for acquiring each text layout pair of different font sizes; aiming at any text layout pair, the text layout pair comprises a preset text layout and a display text layout of a font size corresponding to the text layout pair, and the display text layout is a text layout which is actually displayed after specified data are rendered according to the preset text layout;
a first interval obtaining module, configured to obtain a first interval between each adjacent data block in a preset text layout of each text layout pair;
a second distance obtaining module, configured to obtain a second distance between each adjacent data block in the displayed text layout of each text layout pair;
and the target deviation mapping table establishing module is used for respectively calculating the deviation amount of the first space and the second space of each same adjacent data block of each text layout pair, and storing the deviation amount of each adjacent data block of each text layout pair to obtain a target deviation mapping table.
7. The apparatus of claim 6, wherein when the object code program is a compiler program of a program developer, the deviation amount correction module comprises:
a first target text layout pair determining submodule, configured to query, in the target deviation mapping table, a target text layout pair that is the same as the preset text layout and the display text layout in font size and layout;
a first adjacent data block determination submodule, configured to determine adjacent data blocks in the target text layout pair corresponding to each adjacent data block in the compiler;
a text container spacing adjustment submodule, configured to, for each pair of adjacent data blocks in the compiler, adjust down a text container spacing of the adjacent data block according to a deviation amount of the adjacent data block in the target text layout pair corresponding to the adjacent data block;
and the first target text layout parameter determining submodule is used for determining the text parameters after the text container spacing of each adjacent data block is adjusted as the parameters of the target text layout.
8. The apparatus of claim 6, wherein when the object code program is a design program of a user interface designer, the deviation correction module comprises:
a second target text layout pair determining submodule, configured to query, in the target deviation mapping table, a target text layout pair that is the same as the preset text layout and the display text layout in font size and layout;
a second adjacent data block determination submodule, configured to determine, respectively, adjacent data blocks in the target text layout pair corresponding to each adjacent data block in a design program of the user interface designer;
a marking distance adjusting submodule, configured to, for each pair of adjacent data blocks in the design program of the user interface designer, decrease a marking distance of the adjacent data block according to a deviation amount of the adjacent data block in the target text layout pair corresponding to the adjacent data block;
and the second target text layout parameter determining submodule is used for determining the text parameter after the marking distance of each adjacent data block is adjusted as the parameter of the target text layout.
9. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
the memory is used for storing a computer program;
the processor, when executing a program stored in the memory, implementing the method steps of any of claims 1-4.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 4.
CN201910538164.2A 2019-06-20 2019-06-20 Text layout optimization method and device and electronic equipment Active CN110321124B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910538164.2A CN110321124B (en) 2019-06-20 2019-06-20 Text layout optimization method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910538164.2A CN110321124B (en) 2019-06-20 2019-06-20 Text layout optimization method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN110321124A CN110321124A (en) 2019-10-11
CN110321124B true CN110321124B (en) 2023-01-20

Family

ID=68119934

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910538164.2A Active CN110321124B (en) 2019-06-20 2019-06-20 Text layout optimization method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN110321124B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111506378B (en) * 2020-04-17 2021-09-28 腾讯科技(深圳)有限公司 Method, device and equipment for previewing text display effect and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101859322A (en) * 2010-05-26 2010-10-13 卓望数码技术(深圳)有限公司 Webpage display method for mobile terminal
CN107450912A (en) * 2017-07-07 2017-12-08 北京小米移动软件有限公司 Layout method, device and the terminal of the page
CN108733371A (en) * 2018-05-16 2018-11-02 北京奇艺世纪科技有限公司 A kind of interface creating method, device and equipment
CN109783181A (en) * 2019-01-31 2019-05-21 掌阅科技股份有限公司 Screen is adapted to display methods, electronic equipment and computer storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8984424B2 (en) * 2009-02-03 2015-03-17 Microsoft Technology Licensing, Llc Layout of user interface elements
US20180018305A1 (en) * 2015-02-05 2018-01-18 Hewlett-Packard Development Company, L.P. Character spacing adjustment of text columns

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101859322A (en) * 2010-05-26 2010-10-13 卓望数码技术(深圳)有限公司 Webpage display method for mobile terminal
CN107450912A (en) * 2017-07-07 2017-12-08 北京小米移动软件有限公司 Layout method, device and the terminal of the page
CN108733371A (en) * 2018-05-16 2018-11-02 北京奇艺世纪科技有限公司 A kind of interface creating method, device and equipment
CN109783181A (en) * 2019-01-31 2019-05-21 掌阅科技股份有限公司 Screen is adapted to display methods, electronic equipment and computer storage medium

Also Published As

Publication number Publication date
CN110321124A (en) 2019-10-11

Similar Documents

Publication Publication Date Title
US20150040000A1 (en) Methods and systems for generating server-side media queries
CN111222070B (en) Data processing method, device, equipment and storage medium
CN110515951B (en) BOM standardization method and system, electronic device and storage medium
CN107943466B (en) Database access statement generation method, device and equipment
CN110647562B (en) Data query method and device, electronic equipment and storage medium
CN111611766A (en) Method, apparatus and storage medium for determining circuit layout constraints
EP2988226A1 (en) Electronic document data updating method and device
CN110321124B (en) Text layout optimization method and device and electronic equipment
EP3686760A1 (en) Convolution operation method and apparatus, computer device, and computer-readable storage medium
CN115858831A (en) Data storage method for database
CN112651217B (en) Paper document processing method, paper document processing device, electronic equipment and storage medium
CN109656652B (en) Webpage chart drawing method, device, computer equipment and storage medium
CN113095067A (en) OCR error correction method, device, electronic equipment and storage medium
US20200150855A1 (en) Information processing apparatus and non-transitory computer readable medium storing program
CN115981617A (en) Code sentence recommendation method and device, electronic equipment and storage medium
US20230306193A1 (en) Information processing apparatus, non-transitory computer readable medium, and method for processing information
CN113283231B (en) Method for acquiring signature bit, setting system, signature system and storage medium
CN113642308B (en) Data import method, system, device and storage medium based on data variability
CN115809652A (en) Method and device for automatically synthesizing red-header file
CN115905397A (en) Visual display method, device, system and medium for business data
CN114037493A (en) Method and system for generating bidding document
CN110991164B (en) Legal document processing method and device
CN114428601A (en) Visual manuscript checking method and device
CN109508185B (en) Code review method and device
CN111444456A (en) Method and device for editing style and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant