CN116090417A - Layout document text selection rendering method and device, electronic equipment and storage medium - Google Patents

Layout document text selection rendering method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116090417A
CN116090417A CN202310376945.2A CN202310376945A CN116090417A CN 116090417 A CN116090417 A CN 116090417A CN 202310376945 A CN202310376945 A CN 202310376945A CN 116090417 A CN116090417 A CN 116090417A
Authority
CN
China
Prior art keywords
information
outline
text character
target text
contour
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.)
Granted
Application number
CN202310376945.2A
Other languages
Chinese (zh)
Other versions
CN116090417B (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.)
Fuxin Kunpeng Beijing Information Technology Co ltd
Original Assignee
Fuxin Kunpeng Beijing Information 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 Fuxin Kunpeng Beijing Information Technology Co ltd filed Critical Fuxin Kunpeng Beijing Information Technology Co ltd
Priority to CN202310376945.2A priority Critical patent/CN116090417B/en
Publication of CN116090417A publication Critical patent/CN116090417A/en
Application granted granted Critical
Publication of CN116090417B publication Critical patent/CN116090417B/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/166Editing, e.g. inserting or deleting
    • 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
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/1444Selective acquisition, locating or processing of specific regions, e.g. highlighted text, fiducial marks or predetermined fields
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/18Extraction of features or characteristics of the image
    • G06V30/1801Detecting partial patterns, e.g. edges or contours, or configurations, e.g. loops, corners, strokes or intersections
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The invention relates to the technical field of electric digital data processing, and provides a layout document text selection rendering method, a device, electronic equipment and a storage medium, wherein contour information of each text character selected by a user in a layout document is firstly obtained; then selecting the maximum outline size information from the outline information of the target text characters in the same line in each text character; and finally, adjusting the outline information of the target text character based on the maximum outline size information, and rendering and displaying the target text character based on the adjustment result. The method adjusts the outline information of the target text characters of each line by utilizing the maximum outline size information of each line, and can render the visual effect of the unified highlight effect area so as to accurately feed back the selected text information to the user. Therefore, the interactive experience of the user on the format document can be improved, the user can more easily perform operations such as text copying and annotating, and the reading experience of the user is improved.

Description

Layout document text selection rendering method and device, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of electric digital data processing, in particular to a format document text selection rendering method, a device, electronic equipment and a storage medium.
Background
The layout document technology refers to a technology of creating, editing, and typesetting various documents using computer software and hardware. The format document technology improves the efficiency and quality of document production and brings revolutionary changes to the printing and publishing industries. While conventional manual typesetting and printing requires a great deal of manpower and material resources, modern format document technology can complete typesetting and printing of a great deal of documents in a short time. Meanwhile, the quality and the accuracy of the printed matter are greatly improved.
The format document is an electronic document with a fixed layout presentation effect, and has a display effect independent of a software and hardware platform and relatively strong consistency when being read and printed on various devices, compared with Word (doc, docx) and other streaming documents. The format of the layout document may include PDF, OFD, CEB, SEP, EPUB, etc.
In layout documents, the complexity and diversity of text information presents certain challenges to text selection and rendering. For example, texts with different fonts, sizes, languages and punctuations can all render different visual effects when being selected, so that a user cannot accurately judge the selected text information, the difficulty of copying, annotating and other operations of the user on the selected text information is increased, and the interactive experience of the user is reduced.
Disclosure of Invention
The invention provides a format document text selection rendering method, a device, electronic equipment and a storage medium, which are used for solving the defects in the prior art.
The invention provides a format document text selection rendering method, which comprises the following steps:
acquiring outline information of each text character selected by a user in a layout document;
selecting maximum outline size information from outline information of target text characters in the same line in each text character;
and adjusting the outline information of the target text character based on the maximum outline size information, and rendering and displaying the target text character based on the adjustment result.
According to the layout document text selection rendering method provided by the invention, the contour information of the target text character is adjusted based on the maximum contour size information, and the method comprises the following steps:
if the outline size information in the outline information of the first target text character in the same row is smaller than the maximum outline size information, adjusting the outline information of the first target text character based on the maximum outline size information to obtain an adjustment result;
and based on the adjustment result, carrying out iterative adjustment on the outline information of the rest target text characters in the same row in sequence.
According to the layout document text selection rendering method provided by the invention, the contour information of the first target text character is adjusted based on the maximum contour size information to obtain an adjustment result, and the method comprises the following steps:
calculating a difference between the maximum outline size information and outline size information in the outline information of the first target text character;
and adjusting the outline information of the first target text character based on the difference value to obtain the adjustment result.
According to the layout document text selection rendering method provided by the invention, the outline information of the rest target text characters in the same row is iteratively adjusted in sequence based on the adjustment result, and the method comprises the following steps:
for any remaining target text character, taking a right edge contour line in an adjustment result of a previous text character of the any remaining target text character as a left edge contour line in contour information of the any remaining target text character, taking an upper edge contour line in an adjustment result of the previous text character as an upper edge contour line in contour information of the any remaining target text character, and taking a lower edge contour line in an adjustment result of the previous text character as a lower edge contour line in contour information of the any remaining target text character.
According to the version document text selection rendering method provided by the invention, the maximum outline size information is selected from the outline information of the target text characters, and the method comprises the following steps:
for any two text characters in the text characters, calculating the absolute value of the difference between the first position information and the second position information based on the first contour information of the first text character and the second contour information of the second text character in the any two text characters; the first position information is the position information of the contour center point in the first contour information in the vertical direction, and the second position information is the position information of the contour center point in the second contour information in the vertical direction;
and determining whether any two text characters are in the same row or not based on the absolute value of the difference value.
According to the layout document text selection rendering method provided by the invention, the contour information of the target text character is adjusted based on the maximum contour size information, and the method comprises the following steps:
based on the contour dimension control quantity, adjusting the maximum contour dimension information to obtain target contour dimension information;
and adjusting the outline information of the target text character based on the target outline size information.
According to the method for selecting and rendering the text of the layout document provided by the invention, the contour information of each text character selected by the user in the layout document is obtained, and the method comprises the following steps:
acquiring third position information of the track selected by the user under a screen coordinate system;
converting the third position information into fourth position information under a format document coordinate system;
extracting text character information in the layout document based on the fourth position information;
determining outline information of each text character based on the text character information;
correspondingly, the rendering and displaying the target text character based on the result of the adjustment comprises the following steps:
and rendering and displaying the target text character based on the adjustment result under the screen coordinate system.
The invention also provides a format document text selection rendering device, which comprises:
the information acquisition module is used for acquiring outline information of each text character selected by a user in the format document;
the information selection module is used for selecting the maximum outline size information from the outline information of the target text characters in the same line in the text characters;
and the rendering module is used for adjusting the outline information of the target text character based on the maximum outline size information and rendering and displaying the target text character based on the adjustment result.
The invention also provides electronic equipment, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the format document text selection rendering method according to any one of the above when executing the program.
The invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a layout document text selection rendering method as described in any of the above.
The invention also provides a computer program product comprising a computer program which when executed by a processor implements a layout document text selection rendering method as described in any one of the above.
The invention provides a format document text selection rendering method, a device, electronic equipment and a storage medium, wherein contour information of each text character selected by a user in a format document is firstly obtained; then selecting the maximum outline size information from the outline information of the target text characters in the same line in each text character; and finally, adjusting the outline information of the target text character based on the maximum outline size information, and rendering and displaying the target text character based on the adjustment result. The method adjusts the outline information of the target text characters of each line by utilizing the maximum outline size information of each line, and can render the visual effect of the unified highlight effect area so as to accurately feed back the selected text information to the user. Therefore, the interactive experience of the user on the format document can be improved, the user can more easily perform operations such as text copying and annotating, and the reading experience of the user is improved.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious to those skilled in the art that other drawings can be obtained according to these drawings without inventive effort.
FIG. 1 is a schematic flow diagram of a layout document text selection rendering method provided by the invention;
FIG. 2 is a schematic flow chart for judging whether any two text characters are in the same line in the layout document text selection rendering method provided by the invention;
FIG. 3 is a second flow chart of the layout document text selection rendering method provided by the invention;
FIG. 4 is a schematic structural diagram of a layout document text selection rendering device provided by the invention;
fig. 5 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Because of the complexity and diversity of text information in layout documents in the prior art, certain challenges are presented to text selection and rendering. For example, texts with different fonts, sizes, languages and punctuations can all render different visual effects when being selected, so that a user cannot accurately judge the selected text information, the difficulty of copying, annotating and other operations of the user on the selected text information is increased, and the interactive experience of the user is reduced.
Based on the above, the embodiment of the invention provides a layout document text selection rendering method.
Fig. 1 is a flow chart of a layout document text selection rendering method provided in an embodiment of the present invention, as shown in fig. 1, the method includes:
s11, acquiring outline information of each text character selected by a user in the format document;
s12, selecting maximum outline size information from outline information of target text characters in the same line in the text characters;
and S13, adjusting the outline information of the target text character based on the maximum outline size information, and rendering and displaying the target text character based on the adjustment result.
Specifically, in the layout document text selection rendering method provided in the embodiment of the present invention, the execution body is a layout document text selection rendering device, and the device may be configured in a computer, where the computer may be a local computer or a cloud computer, and the local computer may be a computer, a tablet, or the like, and is not limited herein specifically.
First, step S11 is performed to acquire outline information of each text character selected by the user in the layout document. Here, the user may select text characters through an input terminal such as a mouse or a touch screen, and the text characters may include characters of different fonts, different sizes, punctuations, and the like.
The contour information may include contour dimension information and contour position information, the contour dimension information may include contour width information and contour height information, and the contour position information may be characterized by position information of a contour center point.
Here, the profile information may be profile information in a layout document coordinate system.
Then, step S12 is performed, where each text character is divided into lines, and the text characters in the same line are called target text characters. The text characters are divided according to the rows, whether the difference between the contour height information of the text characters is in a preset range or not can be compared, if so, the text characters are in the same row, and if not, the text characters are in different rows.
For the target text characters in the same row, the maximum outline size information can be selected from the outline information of the target text characters, namely, the outline size information of each target text character in the same row is compared, and the maximum outline size information is selected from the outline size information. The maximum profile size information may include maximum profile width information and maximum profile height information.
Here, the target text characters of the same line may include one or more, depending on the actual selection situation of the user.
Finally, step S13 is executed to adjust the outline information of the target text character by using the maximum outline size information. For example, the outline size information of each target text character is adjusted to be equal to the maximum outline size information, and the adjusted outline edges of adjacent target text characters are ensured to be connected and not to overlap, that is, the outline position information of the rest target text characters except the first target text character in the same line is required to be sequentially adjusted to the right.
And then, rendering and displaying the target text characters according to the adjustment result. Since the rendering display needs to be performed by means of the display screen, it is necessary to ensure that the result of the adjustment is in the screen coordinate system, both the outline information and the maximum outline size information may be converted from the layout document coordinate system to the screen coordinate system after step S12, or the result of the adjustment may be converted from the layout document coordinate system to the screen coordinate system after the result of the adjustment in the layout document coordinate system is obtained, which is not particularly limited herein.
Here, the origin o of coordinates of the screen coordinate system xoy may be an upper left vertex of the display screen, the positive x-axis direction being rightward, and the positive y-axis direction being downward. The origin O of coordinates of the layout document coordinate system XOY may be set at different positions according to different formats of the layout document, for example, if the format of the layout document is OFD, the origin O of coordinates may be an upper left vertex of the layout document, the positive X-axis direction is rightward, the positive Y-axis direction is downward, and if the format of the layout document is PDF, the origin O of coordinates may be a lower left Fang Dingdian of the layout document, the positive X-axis direction is rightward, and the positive Y-axis direction is upward. The present invention is not particularly limited herein.
It is understood that the rendering display may be a full-line highlighting effect rendering of the target text characters of the same line according to the result of the adjustment. The highlighting color may be set in advance by the user, and may be, for example, gray, yellow, pink, purple, or the like, and is not particularly limited herein.
The text selection rendering method of the layout document provided by the embodiment of the invention comprises the steps of firstly, obtaining outline information of each text character selected by a user in the layout document; then selecting the maximum outline size information from the outline information of the target text characters in the same line in each text character; and finally, adjusting the outline information of the target text character based on the maximum outline size information, and rendering and displaying the target text character based on the adjustment result. The method adjusts the outline information of the target text characters of each line by utilizing the maximum outline size information of each line, and can render the visual effect of the unified highlight effect area so as to accurately feed back the selected text information to the user. Therefore, the interactive experience of the user on the format document can be improved, the user can more easily perform operations such as text copying and annotating, and the reading experience of the user is improved.
On the basis of the foregoing embodiment, the layout document text selection rendering method provided in the embodiment of the present invention adjusts the outline information of the target text character based on the maximum outline size information, including:
if the outline size information in the outline information of the first target text character in the same row is smaller than the maximum outline size information, adjusting the outline information of the first target text character based on the maximum outline size information to obtain a first adjustment result;
and based on the first adjustment result, carrying out iterative adjustment on the outline information of the rest target text characters in the same row in sequence.
Specifically, in the embodiment of the present invention, when the profile information of the target text character is adjusted by using the maximum profile information, the profile information of the first target text character in the same line may be adjusted by using the maximum profile information when the profile information of the first target text character in the same line is smaller than the maximum profile information, so as to obtain the first adjustment result. For example, the outline position information of the first target text character may be kept unchanged, but its outline size information may be adjusted to the maximum outline information. The outline position information of the first target text character may be adjusted with reference to the left edge outline and the upper edge outline of the first target text character, and the outline size information may be adjusted to the maximum outline information. The present invention is not particularly limited herein.
And then, using the first adjustment result obtained after adjustment to carry out iterative adjustment on the outline information of the rest target text characters in the same row in sequence. The iterative adjustment is to adjust the contour information of the current target text character by using the contour information of the adjusted previous target text character in the same line.
In the embodiment of the invention, the error probability of the result obtained by adjusting each row can be greatly reduced by an iterative adjustment mode, and the accuracy and the adjustment efficiency of the result obtained by adjusting each row are improved.
Based on the foregoing embodiment, the layout document text selection rendering method provided in the embodiment of the present invention adjusts the outline information of the first target text character based on the maximum outline size information to obtain a first adjustment result, where the first adjustment result includes:
calculating a difference between the maximum outline size information and outline size information in the outline information of the first target text character;
and adjusting the outline information of the first target text character based on the difference value to obtain the first adjustment result.
Specifically, in the embodiment of the invention, in the process of adjusting the outline information of the first target text character by using the maximum outline size information to obtain the first adjustment result, the difference between the maximum outline size information and the outline size information in the outline information of the first target text character is calculated first. If the maximum contour width information is W, the maximum contour height information is H, the contour width information in the contour information of the first target text character is R1, the contour height information in the contour information of R1 is W1, and the contour height information in the contour information of R1 is H1. The difference delta 1=w-W1 corresponding to the contour width information and the difference delta 2=h-H1 corresponding to the contour height information.
And then, adjusting the contour information of the first target text character by utilizing the difference value corresponding to the contour width information and the difference value corresponding to the contour height information to obtain a first adjustment result. For example, the profile position information of R1 may be kept unchanged, the coordinates of the left side edge profile in the profile information of R1 may be decreased by delta1/2, the coordinates of the right side edge profile in the profile information of R1 may be increased by delta1/2, the coordinates of the upper side edge profile in the profile information of R1 may be decreased by delta2/2, and the coordinates of the lower side edge profile in the profile information of R1 may be increased by delta2/2.
In addition, the coordinates of the right edge contour of R1 may be increased by delta1 and the coordinates of the lower edge contour of R1 may be increased by delta2 with respect to the left edge contour and the upper edge contour of R1.
In the embodiment of the invention, two different contour information adjustment modes are provided, so that the adjustment difficulty can be reduced.
On the basis of the foregoing embodiment, the layout document text selection rendering method provided in the embodiment of the present invention iteratively adjusts the outline information of the remaining target text characters in the same line in order based on the first adjustment result, including:
for any remaining target text character, taking a right edge contour line in an adjustment result of a previous text character of the any remaining target text character as a left edge contour line in contour information of the any remaining target text character, taking an upper edge contour line in an adjustment result of the previous text character as an upper edge contour line in contour information of the any remaining target text character, and taking a lower edge contour line in an adjustment result of the previous text character as a lower edge contour line in contour information of the any remaining target text character.
Specifically, the remaining target text characters in the same line may include a second target text character, a third target text character, … …, etc., for which the left edge contour may be adjusted to the right edge contour adjusted for the first target text character, the upper edge contour may be adjusted to the upper edge contour adjusted for the first target text character, and the lower edge contour may be adjusted to the lower edge contour adjusted for the first target text character.
The outline information of the third target text character is adjusted by using the outline information adjusted by the second target text character.
The contour information of the following target text characters is adjusted by analogy, so that the orderly adjustment of the contour information of each target text character in the same row can be ensured, and the problem that the adjustment result is not ideal due to the disorder of the adjustment sequence is avoided.
As shown in fig. 2, on the basis of the foregoing embodiment, the layout document text selection rendering method provided in the embodiment of the present invention, where selecting the maximum outline size information from the outline information of the target text character includes:
for any two text characters in the text characters, calculating the absolute value of the difference between the first position information and the second position information based on the first contour information of the first text character and the second contour information of the second text character in the any two text characters; the first position information is the position information of the contour center point in the first contour information in the vertical direction, and the second position information is the position information of the contour center point in the second contour information in the vertical direction;
and determining whether any two text characters are in the same row or not based on the absolute value of the difference value.
Specifically, before selecting the maximum outline size information from the outline information of the target text character, it is necessary to divide each text character by row. That is, for any two text characters R2 and R3 of each text character, the absolute value of the difference between the first position information and the second position information is calculated using the first outline information of the first text character R2 and the second outline information of the second text character R3. The first position information is the position information of the contour center point in the vertical direction (i.e., y direction) in the first contour information of R2, and the second position information is the position information of the contour center point in the vertical direction in the second contour information of R3.
And then determining whether any two text characters are in the same row or not by using the absolute value of the difference. Here, the absolute value of the difference may be compared with a given constant a, and if the absolute value of the difference is smaller than the given constant a, any two text characters R2 and R3 are considered to be in the same line, otherwise in different lines.
Where a given constant a is used to measure the distance between two adjacent rows, which may be the distance between the horizontal centerlines of the two adjacent rows.
In the embodiment of the invention, whether any two text characters are in the same row is determined by using the absolute value of the difference value, so that each text character can be accurately divided according to rows, and the subsequent rendering and display according to the rows are facilitated.
On the basis of the foregoing embodiment, the layout document text selection rendering method provided in the embodiment of the present invention adjusts the outline information of the target text character based on the maximum outline size information, including:
based on the contour dimension control quantity, adjusting the maximum contour dimension information to obtain target contour dimension information;
and adjusting the outline information of the target text character based on the target outline size information.
Specifically, when the contour information of the target text character is adjusted by using the maximum contour size information, a contour size control amount may be introduced, and the maximum contour size information is adjusted by using the contour size control amount, that is, the maximum contour width information in the maximum contour size information is increased by the contour size control amount, and the maximum contour width information is increased by the contour size control amount, so that the target contour size information can be obtained.
And then adjusting the outline information of the target text character by utilizing the target outline size information. The adjustment process is consistent with the process of adjusting the outline information of the target text character using the maximum outline size information, except that the target outline size information is different from the maximum outline size information in value.
In the embodiment of the invention, the maximum outline size information is adjusted by the outline size control quantity, so that the whole highlight rendering effect is ensured not to tightly wrap the characters, and the user experience is improved.
On the basis of the above embodiment, the method for selecting and rendering the text of the layout document provided in the embodiment of the present invention, where the obtaining the outline information of each text character selected by the user in the layout document includes:
acquiring third position information of the track selected by the user under a screen coordinate system;
converting the third position information into fourth position information under a format document coordinate system;
extracting text character information in the layout document based on the fourth position information;
determining outline information of each text character based on the text character information;
correspondingly, the rendering and displaying the target text character based on the result of the adjustment comprises the following steps:
and rendering and displaying the target text character based on the adjustment result under the screen coordinate system.
Specifically, when the outline information of each text character selected by the user in the layout document is obtained, when the user selects the text character through an input terminal such as a mouse or a touch screen, the track is recorded from a pressing event of the user triggering the input device, and the third position information of the track selected by the user under the screen coordinate system is obtained.
And then converting the third position information into fourth position information under the format document coordinate system, analyzing page information corresponding to the format document under the format document coordinate system, and extracting text character information in the page information of the format document by utilizing the fourth position information. The text character information may include each text character in the layout document, related index information, etc., and the text character information may be stored in the set A1.
Thereafter, outline information of each text character with respect to the page can be determined using the associated index information in the text character information. The profile information may be stored in set A2.
Further, when the target text character is rendered and displayed by using the adjustment result, the target text character is rendered and displayed based on the adjustment result in the screen coordinate system.
In summary, as shown in fig. 3, the layout document text selection rendering method provided in the embodiment of the present invention includes:
s31, extracting text character information in the format document;
s32, determining outline information of each text character based on the text character information;
s33, selecting maximum outline size information from outline information of target text characters for the target text characters in the same row in each text character;
s34, if the outline size information in the outline information of the first target text character in the same row is smaller than the maximum outline size information, adjusting the outline information of the first target text character based on the maximum outline size information to obtain an adjustment result;
s35, based on the adjustment result, carrying out iterative adjustment on the outline information of the rest target text characters in the same row in sequence;
and S36, rendering and displaying the target text characters based on the adjustment result.
As shown in fig. 4, on the basis of the above embodiment, an embodiment of the present invention provides a layout document text selection rendering device, including:
an information obtaining module 41, configured to obtain outline information of each text character selected by a user in the layout document;
an information selecting module 42, configured to select, for a target text character in the same line among the text characters, maximum outline size information from outline information of the target text character;
and the rendering module 43 is configured to adjust the outline information of the target text character based on the maximum outline size information, and render and display the target text character based on a result obtained by the adjustment.
On the basis of the above embodiment, the layout document text selection rendering device provided in the embodiment of the present invention, the rendering module is configured to:
if the outline size information in the outline information of the first target text character in the same row is smaller than the maximum outline size information, adjusting the outline information of the first target text character based on the maximum outline size information to obtain an adjustment result;
and based on the adjustment result, carrying out iterative adjustment on the outline information of the rest target text characters in the same row in sequence.
On the basis of the above embodiment, the layout document text selection rendering device provided in the embodiment of the present invention, the rendering module is specifically configured to:
calculating a difference between the maximum outline size information and outline size information in the outline information of the first target text character;
and adjusting the outline information of the first target text character based on the difference value to obtain the adjustment result.
On the basis of the above embodiment, the layout document text selection rendering device provided in the embodiment of the present invention, the rendering module is specifically configured to:
for any remaining target text character, taking a right edge contour line in an adjustment result of a previous text character of the any remaining target text character as a left edge contour line in contour information of the any remaining target text character, taking an upper edge contour line in an adjustment result of the previous text character as an upper edge contour line in contour information of the any remaining target text character, and taking a lower edge contour line in an adjustment result of the previous text character as a lower edge contour line in contour information of the any remaining target text character.
On the basis of the above embodiment, the layout document text selection rendering device provided in the embodiment of the present invention further includes a judging module, configured to:
for any two text characters in the text characters, calculating the absolute value of the difference between the first position information and the second position information based on the first contour information of the first text character and the second contour information of the second text character in the any two text characters; the first position information is the position information of the contour center point in the first contour information in the vertical direction, and the second position information is the position information of the contour center point in the second contour information in the vertical direction;
and determining whether any two text characters are in the same row or not based on the absolute value of the difference value.
On the basis of the above embodiment, the layout document text selection rendering device provided in the embodiment of the present invention, the rendering module is further specifically configured to:
based on the contour dimension control quantity, adjusting the maximum contour dimension information to obtain target contour dimension information;
and adjusting the outline information of the target text character based on the target outline size information.
On the basis of the above embodiment, the layout document text selection rendering device provided in the embodiment of the present invention, the information acquisition module is specifically configured to:
acquiring third position information of the track selected by the user under a screen coordinate system;
converting the third position information into fourth position information under a format document coordinate system;
extracting text character information in the layout document based on the fourth position information;
determining outline information of each text character based on the text character information;
correspondingly, the rendering module is further specifically configured to:
and rendering and displaying the target text character based on the adjustment result under the screen coordinate system.
Specifically, the functions of each module in the format document text selection rendering device provided in the embodiment of the present invention are in one-to-one correspondence with the operation flows of each step in the above method embodiment, and the achieved effects are consistent.
Fig. 5 illustrates a physical schematic diagram of an electronic device, as shown in fig. 5, which may include: processor (Processor) 510, communication interface (Communications Interface) 520, memory (Memory) 530, and communication bus 540, wherein Processor 510, communication interface 520, memory 530 complete communication with each other through communication bus 540. Processor 510 may invoke logic instructions in memory 530 to perform the layout document text selection rendering method provided in the embodiments described above, the method comprising: acquiring outline information of each text character selected by a user in a layout document; selecting maximum outline size information from outline information of target text characters in the same line in each text character; and adjusting the outline information of the target text character based on the maximum outline size information, and rendering and displaying the target text character based on the adjustment result.
Further, the logic instructions in the memory 530 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, the computer program product including a computer program, the computer program being storable on a non-transitory computer readable storage medium, the computer program, when executed by a processor, being capable of executing the format document text selection rendering method provided in the above embodiments, the method including: acquiring outline information of each text character selected by a user in a layout document; selecting maximum outline size information from outline information of target text characters in the same line in each text character; and adjusting the outline information of the target text character based on the maximum outline size information, and rendering and displaying the target text character based on the adjustment result.
In still another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the layout document text selection rendering method provided in the above embodiments, the method comprising: acquiring outline information of each text character selected by a user in a layout document; selecting maximum outline size information from outline information of target text characters in the same line in each text character; and adjusting the outline information of the target text character based on the maximum outline size information, and rendering and displaying the target text character based on the adjustment result.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A layout document text selection rendering method, comprising:
acquiring outline information of each text character selected by a user in a layout document;
selecting maximum outline size information from outline information of target text characters in the same line in each text character;
and adjusting the outline information of the target text character based on the maximum outline size information, and rendering and displaying the target text character based on the adjustment result.
2. The layout document text selection rendering method of claim 1, wherein the adjusting the outline information of the target text character based on the maximum outline size information includes:
if the outline size information in the outline information of the first target text character in the same row is smaller than the maximum outline size information, adjusting the outline information of the first target text character based on the maximum outline size information to obtain an adjustment result;
and based on the adjustment result, carrying out iterative adjustment on the outline information of the rest target text characters in the same row in sequence.
3. The layout document text selection rendering method according to claim 2, wherein the adjusting the outline information of the first target text character based on the maximum outline size information to obtain an adjustment result includes:
calculating a difference between the maximum outline size information and outline size information in the outline information of the first target text character;
and adjusting the outline information of the first target text character based on the difference value to obtain the adjustment result.
4. The layout document text selection rendering method according to claim 2, wherein the iteratively adjusting the outline information of the remaining target text characters in the same line in order based on the adjustment result includes:
for any remaining target text character, taking a right edge contour line in an adjustment result of a previous text character of the any remaining target text character as a left edge contour line in contour information of the any remaining target text character, taking an upper edge contour line in an adjustment result of the previous text character as an upper edge contour line in contour information of the any remaining target text character, and taking a lower edge contour line in an adjustment result of the previous text character as a lower edge contour line in contour information of the any remaining target text character.
5. The layout document text selection rendering method according to any one of claims 1 to 4, wherein the selecting the maximum outline size information from the outline information of the target text character previously includes:
for any two text characters in the text characters, calculating the absolute value of the difference between the first position information and the second position information based on the first contour information of the first text character and the second contour information of the second text character in the any two text characters; the first position information is the position information of the contour center point in the first contour information in the vertical direction, and the second position information is the position information of the contour center point in the second contour information in the vertical direction;
and determining whether any two text characters are in the same row or not based on the absolute value of the difference value.
6. The layout document text selection rendering method according to any one of claims 1 to 4, wherein the adjusting the outline information of the target text character based on the maximum outline size information includes:
based on the contour dimension control quantity, adjusting the maximum contour dimension information to obtain target contour dimension information;
and adjusting the outline information of the target text character based on the target outline size information.
7. The layout document text selection rendering method according to any one of claims 1 to 4, wherein the obtaining outline information of each text character selected by a user in the layout document includes:
acquiring third position information of the track selected by the user under a screen coordinate system;
converting the third position information into fourth position information under a format document coordinate system;
extracting text character information in the layout document based on the fourth position information;
determining outline information of each text character based on the text character information;
correspondingly, the rendering and displaying the target text character based on the result of the adjustment comprises the following steps:
and rendering and displaying the target text character based on the adjustment result under the screen coordinate system.
8. A layout document text selection rendering apparatus, comprising:
the information acquisition module is used for acquiring outline information of each text character selected by a user in the format document;
the information selection module is used for selecting the maximum outline size information from the outline information of the target text characters in the same line in the text characters;
and the rendering module is used for adjusting the outline information of the target text character based on the maximum outline size information and rendering and displaying the target text character based on the adjustment result.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the layout document text selection rendering method of any of claims 1-7 when the program is executed.
10. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the format document text selection rendering method of any of claims 1-7.
CN202310376945.2A 2023-04-11 2023-04-11 Layout document text selection rendering method and device, electronic equipment and storage medium Active CN116090417B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310376945.2A CN116090417B (en) 2023-04-11 2023-04-11 Layout document text selection rendering method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310376945.2A CN116090417B (en) 2023-04-11 2023-04-11 Layout document text selection rendering method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116090417A true CN116090417A (en) 2023-05-09
CN116090417B CN116090417B (en) 2023-06-27

Family

ID=86212424

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310376945.2A Active CN116090417B (en) 2023-04-11 2023-04-11 Layout document text selection rendering method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116090417B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009193170A (en) * 2008-02-12 2009-08-27 Canon Inc Character recognition device and character recognition method
JP2010231686A (en) * 2009-03-30 2010-10-14 Fujitsu Ltd Device, method and program for extracting document area from image
US20110007970A1 (en) * 2009-07-10 2011-01-13 Palo Alto Research Center Incorporated System and method for segmenting text lines in documents
CN102479215A (en) * 2010-11-30 2012-05-30 汉王科技股份有限公司 Automatic file exporting method and electronic reading device
CN104239305A (en) * 2013-06-07 2014-12-24 阿里巴巴集团控股有限公司 Electronic document generating and displaying method and apparatus
CN104951429A (en) * 2014-03-26 2015-09-30 阿里巴巴集团控股有限公司 Recognition method and device for page headers and page footers of format electronic document
CN109657629A (en) * 2018-12-24 2019-04-19 科大讯飞股份有限公司 A kind of line of text extracting method and device
CN112949514A (en) * 2021-03-09 2021-06-11 广州文石信息科技有限公司 Scanned document information processing method and device, electronic equipment and storage medium
CN114118011A (en) * 2021-11-23 2022-03-01 掌阅科技股份有限公司 Document processing method, electronic device and storage medium
CN114598921A (en) * 2022-03-07 2022-06-07 广东小天才科技有限公司 Video frame extraction method and device, terminal equipment and storage medium
CN115131803A (en) * 2022-04-20 2022-09-30 腾讯科技(深圳)有限公司 Document word size identification method and device, computer equipment and storage medium
CN115759006A (en) * 2022-11-21 2023-03-07 网易有道信息技术(北京)有限公司 Document rendering method and device, electronic equipment and storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009193170A (en) * 2008-02-12 2009-08-27 Canon Inc Character recognition device and character recognition method
JP2010231686A (en) * 2009-03-30 2010-10-14 Fujitsu Ltd Device, method and program for extracting document area from image
US20110007970A1 (en) * 2009-07-10 2011-01-13 Palo Alto Research Center Incorporated System and method for segmenting text lines in documents
CN102479215A (en) * 2010-11-30 2012-05-30 汉王科技股份有限公司 Automatic file exporting method and electronic reading device
CN104239305A (en) * 2013-06-07 2014-12-24 阿里巴巴集团控股有限公司 Electronic document generating and displaying method and apparatus
CN104951429A (en) * 2014-03-26 2015-09-30 阿里巴巴集团控股有限公司 Recognition method and device for page headers and page footers of format electronic document
CN109657629A (en) * 2018-12-24 2019-04-19 科大讯飞股份有限公司 A kind of line of text extracting method and device
CN112949514A (en) * 2021-03-09 2021-06-11 广州文石信息科技有限公司 Scanned document information processing method and device, electronic equipment and storage medium
CN114118011A (en) * 2021-11-23 2022-03-01 掌阅科技股份有限公司 Document processing method, electronic device and storage medium
CN114598921A (en) * 2022-03-07 2022-06-07 广东小天才科技有限公司 Video frame extraction method and device, terminal equipment and storage medium
CN115131803A (en) * 2022-04-20 2022-09-30 腾讯科技(深圳)有限公司 Document word size identification method and device, computer equipment and storage medium
CN115759006A (en) * 2022-11-21 2023-03-07 网易有道信息技术(北京)有限公司 Document rendering method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN116090417B (en) 2023-06-27

Similar Documents

Publication Publication Date Title
US8718364B2 (en) Apparatus and method for digitizing documents with extracted region data
US8155944B2 (en) Translation apparatus, translation method and computer readable medium
US8515176B1 (en) Identification of text-block frames
US8830241B1 (en) Image conversion of text-based images
US9460089B1 (en) Flow rendering of annotation characters
US7786994B2 (en) Determination of unicode points from glyph elements
JP2012199901A (en) Document modification detecting method by character comparison using character shape feature
CN111476006B (en) PDF file online annotation method, device, equipment and readable storage medium
US9734132B1 (en) Alignment and reflow of displayed character images
US11348331B2 (en) Information processing apparatus and non-transitory computer readable medium
US9535880B2 (en) Method and apparatus for preserving fidelity of bounded rich text appearance by maintaining reflow when converting between interactive and flat documents across different environments
CN104133809B (en) Font style bolding method
CN116402020A (en) Signature imaging processing method, system and storage medium based on OFD document
EP2410487B1 (en) Method for automatically modifying a graphics feature to comply with a resolution limit
CN116090417B (en) Layout document text selection rendering method and device, electronic equipment and storage medium
US10733355B2 (en) Information processing system that stores metrics information with edited form information, and related control method information processing apparatus, and storage medium
US9135677B2 (en) Apparatus which layout one or more images and produce output, and the method thereof
KR20230069374A (en) An automatic image placement and execution method using the DTP program, an adobe indesign
CN111444452B (en) Webpage conversion method and device and storage medium
KR101651842B1 (en) Method and device for generating layout of electronic document
CN111046096B (en) Method and device for generating graphic structured information
CN116740235A (en) Text annotation rendering method and device based on format document
US11526714B2 (en) Method and apparatus for anisotropically modifying text attributes to comply with a resolution limit
KR20120136313A (en) Apparatus for text to speech of electronic book and method thereof
US10387541B2 (en) High quality setting of text for print, with full control over layout, using a web browser

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