CN116740235A - Text annotation rendering method and device based on format document - Google Patents

Text annotation rendering method and device based on format document Download PDF

Info

Publication number
CN116740235A
CN116740235A CN202311017007.XA CN202311017007A CN116740235A CN 116740235 A CN116740235 A CN 116740235A CN 202311017007 A CN202311017007 A CN 202311017007A CN 116740235 A CN116740235 A CN 116740235A
Authority
CN
China
Prior art keywords
text annotation
rendering
character
application view
coordinates
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.)
Pending
Application number
CN202311017007.XA
Other languages
Chinese (zh)
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 CN202311017007.XA priority Critical patent/CN116740235A/en
Publication of CN116740235A publication Critical patent/CN116740235A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/169Annotation, e.g. comment data or footnotes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • 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)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The invention provides a text annotation rendering method and device based on format documents, which relate to the technical field of computers, and the method comprises the following steps: responding to text annotation information input by a user, and rendering the text annotation information in real time in a preset application view; converting character coordinates of at least one text annotation character rendered in the application view into document coordinates in the layout document page; and responding to an input completion instruction of a user, and rendering each text annotation character in a layout document page based on the document coordinates. According to the embodiment of the invention, the text annotation information is rendered on the application view and the format document page separately, the application view with higher instantaneity is firstly rendered, so that the text annotation information input by a user is displayed near real time, after the user confirms that the text annotation information is input completely through the input completion instruction indication, the text annotation information is rendered in the format document page with lower instantaneity, and the user experience is improved.

Description

Text annotation rendering method and device based on format document
Technical Field
The invention relates to the technical field of computers, in particular to a text annotation rendering method and device based on a format document.
Background
In layout documents, text annotation is an important function that can help users interpret, supplement, or mark text content.
At present, the layout document has no concept of rows and columns, and only positions characters through coordinates, so that problems occur in the text interaction process, for example, when a user adds text notes in the layout document, the problems of real-time performance, such as flickering, occur, and the real-time performance problem is particularly prominent in mobile terminal equipment with limited hardware resources, which can cause interference to the reading experience of the user, poor usability and usability of the text notes and poor user experience.
Disclosure of Invention
The invention provides a text annotation rendering method and device based on a format document, which are used for solving the problems of poor availability and usability of text annotations and poor user experience in the prior art.
The invention provides a text annotation rendering method based on a format document, which comprises the following steps:
responding to text annotation information input by a user, and rendering the text annotation information in real time in a preset application view;
converting character coordinates of at least one text annotation character rendered in the application view into document coordinates in a layout document page;
And responding to the input completion instruction of the user, and rendering each text annotation character in the format document page based on the document coordinates.
According to the text annotation rendering method based on the layout document provided by the invention, after each text annotation character is rendered in the page of the layout document based on the document coordinates, the method further comprises:
and deleting the rendering effect in the application view after the text annotation characters are rendered in the format document page.
According to the text annotation rendering method based on the layout document, each text annotation character is rendered in the page of the layout document based on the document coordinates, and the method comprises the following steps:
rendering each text annotation character in the layout document page based on the document coordinates and character attribute information of each text annotation character;
the character attribute information comprises at least one of color, font size, abscissa X, character transverse dimension DeltaX, ordinate Y, character longitudinal dimension DeltaY, word spacing and line spacing of each text annotation character.
According to the text annotation rendering method based on the format document, the text annotation information is rendered in real time in a preset application view, and the method comprises the following steps:
acquiring initial position coordinates of a cursor in the application view and boundary coordinates of the application view;
calculating a first distance between the cursor and a boundary of the application view based on the initial position coordinates and the boundary coordinates;
calculating the number n of characters supported and accommodated in a single row in the application view based on the first distance and the attribute information of each character in the text annotation information, wherein n is an integer greater than 0;
and in the process of rendering the text annotation information in real time, if the number of characters input by the current line in the application view is greater than n, rendering the characters greater than n on the next line of the current line.
According to the text annotation rendering method based on the layout document provided by the invention, after the first distance between the cursor and the boundary of the application view is calculated based on the initial position coordinate and the boundary coordinate, the method further comprises the following steps:
calculating the total line number m supported and accommodated in the application view based on the first distance and the attribute information of each character in the text annotation information, wherein m is an integer greater than 0;
And in the process of rendering the text annotation information in real time, if the number of lines of the currently input characters in the application view is greater than m, moving the currently input characters upwards by p lines, wherein p is the difference value between the number of lines of the currently input characters and m.
According to the text annotation rendering method based on the format document, the method further comprises the following steps:
calculating a second distance between a first row of characters in the currently input characters and an upper boundary of the application view in the process of rendering the text annotation information in real time;
and if the second distance is smaller than a preset first threshold value, stopping executing the upward movement operation on the currently input character, and outputting prompt information for representing insufficient space.
According to the text annotation rendering method based on the format document, the method further comprises the following steps:
under the condition of editing text annotation characters which are rendered in the format document page, acquiring the text annotation characters which are rendered in the format document page and corresponding related information;
rendering the text annotation character in the application view based on the text annotation character and corresponding related information;
After rendering is completed, hiding text annotation characters in the format document page;
responding to the editing instruction of the user, and rendering the edited text annotation characters in real time in the application view;
converting character coordinates of edited text annotation characters rendered in the application view into edited document coordinates in a layout document page;
and responding to the editing completion instruction of the user, and rendering the edited text annotation characters in the format document page based on the edited document coordinates.
The invention also provides a text annotation rendering device based on the format document, which comprises:
the first rendering module is used for responding to text annotation information input by a user and rendering the text annotation information in real time in a preset application view;
the conversion module is used for converting character coordinates of at least one text annotation character rendered in the application view into document coordinates in a format document page;
and the second rendering module is used for responding to the input completion instruction of the user and rendering each text annotation character in the format document page based on the document coordinates.
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 text annotation rendering method based on the format document when executing the program.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a text annotation rendering method based on a layout document 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 text annotation rendering method based on a layout document as described in any of the above.
According to the text annotation rendering method and device based on the layout document, the text annotation information input by the user is responded, the text annotation information is rendered in real time in the application view, then the character coordinates of at least one text annotation character rendered in the application view are converted into the document coordinates in the layout document page, and further the text annotation character can be rendered in the layout document page based on the document coordinates in response to the input completion instruction of the user. Compared with the real-time problem in the related art, the embodiment of the invention has the advantages that the text annotation information is rendered on the application view and the format document page separately, the application view with higher real-time property is firstly rendered, the text annotation information input by a user is displayed near real-time, after the user confirms that the text annotation information is input through the input completion instruction indication, the text annotation information is rendered in the format document page with lower real-time property, the reading experience of the user is not disturbed in the process of inputting the user, the interaction frequency of the application view and the format document page can be reduced, the real-time property is improved, the flicker and other problems are effectively improved, the usability and usability of the text annotation are improved, and the user experience is further 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 that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow diagram of one of the text annotation rendering methods based on layout documents provided by the present invention;
FIG. 2 is a schematic diagram of a text positioning mechanism of an OFD format document in the format document-based text annotation rendering method provided by the invention;
FIG. 3 is a second flow chart of a text annotation rendering method based on layout documents provided by the invention;
FIG. 4 is a schematic diagram of a text annotation rendering device based on a layout document according to the present 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.
The text annotation rendering method and device based on the format document are described below with reference to the accompanying drawings.
FIG. 1 is a schematic flow chart of a text annotation rendering method based on a layout document, as shown in FIG. 1, the method includes steps 101 to 103; wherein:
and step 101, responding to text annotation information input by a user, and rendering the text annotation information in real time in a preset application view.
Step 102, converting character coordinates of at least one text annotation character rendered in the application view into document coordinates in a layout document page.
And step 103, responding to the input completion instruction of the user, and rendering each text annotation character in the layout document page based on the document coordinates.
In the related art, since there is no concept of rows and columns in the layout document, a lot of problems occur in the text interaction process only by locating the character positions through coordinates, and the what is seen in the existing implementation scheme is definitely a better experience mode, however, the what is seen in the existing implementation scheme has high real-time requirements, and users may encounter some experience problems, such as jitter, flicker, inconsistent text rendering effects, ghost and the like, when adding text annotations.
For example, for a device with a slower processing speed, it is difficult to timely render the text annotation input by the user and the original format document, so that a delay situation that the user has input the content and the content cannot be timely rendered may occur, and a situation that the user will flash appears to occur on the user side may result in poor user experience.
Aiming at the problems, the embodiment of the invention adopts the following technical conception: the text annotation information is rendered on the application view and the format document page separately, the application view with higher real-time performance is firstly rendered, the text annotation information input by a user is displayed near real-time, and after the user confirms that the text annotation information is input completely through the input completion instruction indication, the text annotation information is rendered on the format document page with lower real-time performance.
Specifically, in the embodiment of the invention, in response to text annotation information input by a user, the text annotation information is firstly rendered in real time in an application view, wherein the application view is usually in an application layer, and the real-time performance is higher.
Optionally, the application view is, for example, a transparent display box to avoid obscuring the content in the layout document page.
In one embodiment, the text rendering in the application view is as follows: and acquiring position coordinates (x, y) clicked on the application view, drawing an input cursor at the clicked position, prompting a user to start typing in text, acquiring text information (text annotation information) input by the user in real time, and sequentially drawing the text annotation information from the position of the cursor, wherein preset fonts, word sizes and word color information can be used for rendering, and preset word spacing and line spacing information can be used for controlling typesetting effects of words.
And converting the character coordinates of at least one text annotation character rendered in the application view into document coordinates in the layout document page, so that the text annotation character can be rendered in the layout document page based on the document coordinates in response to the input completion instruction of the user.
Alternatively, the layout Document includes, for example, an Open-layout Document (OFD).
It should be noted that, the embodiment of the present invention does not limit the execution sequence of step 102 and step 103, and step 102 and step 103 may be executed simultaneously, for example, in response to the input of the user to complete the instruction, coordinate conversion is performed first, and then each text annotation character is rendered in the layout document page based on the document coordinates; the coordinate conversion can be performed in the process of rendering the text annotation information in real time in the application view, and then the text annotation characters can be rendered in the format document page directly based on the document coordinates in response to the input completion instruction of the user.
Compared with the real-time problem in the related art, the text annotation rendering method based on the format document provided by the embodiment of the invention has the advantages that the text annotation information is firstly rendered on the application view with higher real-time performance in a manner of being close to real-time to display the text annotation information input by the user, after the user confirms that the text annotation information is input through the input completion instruction, the text annotation information is rendered in the format document page with lower real-time performance, the reading experience of the user is not disturbed in the process of inputting by the user, the interaction frequency of the application view and the format document page can be reduced, the real-time performance is improved, the problems of flickering and the like are effectively improved, the usability and the usability of the text annotation are improved, and the user experience is further improved.
The aim of the embodiment of the invention is mainly that: the interactive experience of adding and editing text annotation information by a user is improved.
For adding text annotation information, optionally, after each text annotation character is rendered in the layout document page based on the document coordinates, the rendering effect in the application view may be deleted after each text annotation character is rendered in the layout document page.
Specifically, when excessive text annotation information is added, the situation that rendering time of text annotation characters in a format document page is long may occur, in order to avoid the situation that characters flash, in the embodiment of the invention, the text annotation area is refreshed first, that is, after rendering of each text annotation character in the format document page is completed, the rendering effect in the application view is deleted, the sequence cannot be reversed here, the situation that characters flash is effectively avoided, and user experience is improved.
For editing text annotation information, optionally, text annotation characters which are already rendered in the format document page and corresponding related information can be obtained under the condition of editing the text annotation characters which are already rendered in the format document page;
rendering the text annotation character in the application view based on the text annotation character and corresponding related information;
after rendering is completed, hiding text annotation characters in the format document page;
responding to the editing instruction of the user, and rendering the edited text annotation characters in real time in the application view;
converting character coordinates of edited text annotation characters rendered in the application view into edited document coordinates in a layout document page;
And responding to the editing completion instruction of the user, and rendering the edited text annotation characters in the format document page based on the edited document coordinates.
Specifically, the process of editing text annotation characters in a layout document page can be divided into the following steps:
1) Firstly, acquiring text annotation characters and corresponding related information (text content, word size, color and the like) in a format document page;
2) Rendering the acquired text annotation characters and corresponding related information in the application view (at the moment, the rendering effect in the format document page is still in);
3) Rendering of text annotation characters in the application view is completed (two layers of rendering effects are present at this time);
4) Hiding the rendering effect in the dropped-version document page, and refreshing the region where the annotation is located in the version document page (only the rendering effect of the application view is achieved at the moment);
5) New content that the user begins editing is rendered in the application view of the application layer.
Wherein steps 2) and 3) are performed at a fast speed, and the description is broken down here for illustrative purposes.
In the embodiment of the invention, if text annotation characters rendered in a format document page are to be edited, the text annotation characters and corresponding related information, such as text content, word size, color and the like, in the format document page should be acquired first; and rendering the text annotation characters in the application view based on the acquired text annotation characters and corresponding related information, hiding the text annotation characters in the format document page after the rendering is completed, only rendering effects of the application view are presented at the moment, so that a user can edit the text annotation characters through the application view, and then converting and rendering the edited text annotation characters in the format document page from the application view under the condition that the editing is completed, thereby avoiding inconsistent rendering effects of two layers before and after the editing and flickering, and improving user experience.
Optionally, editing includes operations such as deletion, modification, and the like.
Optionally, the implementation of rendering each text annotation character in the layout document page based on the document coordinates may include:
rendering each text annotation character in the layout document page based on the document coordinates and character attribute information of each text annotation character;
the character attribute information comprises at least one of color, font size, abscissa X, character transverse dimension DeltaX, ordinate Y, character longitudinal dimension DeltaY, word spacing and line spacing of each text annotation character.
Specifically, fig. 2 is a schematic diagram of a text positioning mechanism of an OFD format document in the text annotation rendering method based on a format document, and as shown in fig. 2, the combination of X, Y and DeltaX determines the accurate position of each font drawing point corresponding to a test text in the diagram.
According to the embodiment of the invention, the text annotation characters can be rendered into the format document page by referring to the document coordinates of the text annotation characters and the character attribute information of the text annotation characters, for example, the rendering effect of the characters rendered into the format document page and the rendering effect of the characters in the application view can be kept consistent, and particularly the colors, fonts, word sizes, coordinates, sizes, intervals and the like of the two characters can be kept consistent, so that the problems of jitter, flickering, inconsistent text rendering effects, double images and the like can be effectively reduced, and the user experience is improved.
Optionally, the implementation manner of rendering the text annotation information in real time in the preset application view may include:
acquiring initial position coordinates of a cursor in the application view and boundary coordinates of the application view;
calculating a first distance between the cursor and a boundary of the application view based on the initial position coordinates and the boundary coordinates;
calculating the number n of characters supported and accommodated in a single row in the application view based on the first distance and the attribute information of each character in the text annotation information, wherein n is an integer greater than 0;
and in the process of rendering the text annotation information in real time, if the number of characters input by the current line in the application view is greater than n, rendering the characters greater than n on the next line of the current line.
Specifically, the embodiment of the invention utilizes boundary detection and combines automatic line feed, so that the position and the size of the text annotation can be ensured to be in a reasonable range, the page exceeding or the overlapping with other text contents can be avoided, in addition, the automatic line feed can adapt the annotation text to different screen sizes and display environments, and better reading experience is provided for users.
Optionally, after calculating the first distance between the cursor and the boundary of the application view based on the initial position coordinates and the boundary coordinates, the following steps may be performed:
calculating the total line number m supported and accommodated in the application view based on the first distance and the attribute information of each character in the text annotation information, wherein m is an integer greater than 0;
and in the process of rendering the text annotation information in real time, if the number of lines of the currently input characters in the application view is greater than m, moving the currently input characters upwards by p lines, wherein p is the difference value between the number of lines of the currently input characters and m.
Specifically, the embodiment of the invention utilizes boundary detection and combines automatic page up-shifting, so that the display position of the page can be automatically adjusted when the user adds the notes, the user can directly see the added text notes, the operations of scrolling and searching are reduced, and the user experience is improved.
Optionally, a second distance between a first line of characters in the currently input characters and an upper boundary of the application view may be calculated in a process of rendering the text annotation information in real time;
And if the second distance is smaller than a preset first threshold value, stopping executing the upward movement operation on the currently input character, and outputting prompt information for representing insufficient space.
Specifically, in the process of rendering text annotation information in real time, the embodiment of the invention can calculate the second distance between the first row of characters in the currently input characters and the upper boundary of the application view in real time, if the second distance is smaller than the first threshold value, the newly input characters can be considered to be displayed in no space in the application view, at the moment, the upward movement operation on the currently input characters can be stopped, and prompt information for representing insufficient space is output to prompt the user that the space is insufficient.
The text annotation rendering method based on the format document provided by the embodiment of the invention is exemplified as follows.
In the embodiment of the invention, the text annotation information on the page of the application view and the page of the format document are separately rendered, so that the interaction frequency of the application view and the format document is reduced, and the instantaneity is improved. Creating a new text annotation process to generate one-time interaction, namely completing the content input and storing the content into a document; the text annotation editing process generates two interactions, namely, text annotation is selected to be drawn to an application view once, and the text annotation is saved back to a document once after editing is completed, and the text annotation is generated twice.
Information such as preset font, font size (fontSize), color, word spacing (wordspace), and line spacing (linespace) is applied.
FIG. 3 is a second flow chart of a text annotation rendering method based on layout document according to the present invention, as shown in FIG. 3, the method includes:
s10, acquiring position coordinates (x, y) clicked on the application view, drawing an input cursor on the clicked position, prompting a user to start typing a text, and acquiring text annotation information input by the user in real time for drawing.
Specifically, text rendering, namely acquiring position coordinates (x, y) clicked on an application view, drawing an input cursor at the clicked position, prompting a user to start inputting text, acquiring text information input by the user in real time, sequentially drawing the text information from the position of the cursor, rendering by using preset fonts, word sizes and word color information, and controlling typesetting effects of words by using preset word spacing and line spacing information; the word spacing and the line spacing are introduced to realize dynamic adjustment of typesetting patterns, so that the typesetting is convenient and simple, and is not a coordinate-oriented mode, tedious and error-prone, and the drawn content is rendered in an application view.
Character outline rendering width charwidth=fontsize+wordspace, 1 word space on the right side of the character; the left side of the first character of each row has a 1-word space, namely, the horizontal coordinate of the rendering position of the first character is x+wordspace, the horizontal coordinate of the rendering position of the second character is x+wordspace+charwidth, the horizontal coordinate of the rendering position of the third character is x+wordspace+2 x charWidth, and the horizontal coordinate of the rendering position of the nth character is x+wordspace+ (n-1) x charWidth.
Character outline rendering height charheight=fontsize+linespace, and 1 line space is arranged on the upper side of the character; the underside of the last line of characters has 1 line spacing. That is, the ordinate of the rendering position of the first character is y, the ordinate of the same-row character is the same, the ordinate of the rendering position of the second row of characters is y+charheight, the ordinate of the rendering position of the third row of characters is y+2 x charHeight, the ordinate of the rendering position of the nth row of characters is y+ (n-1) x charHeight, and the 1 row spacing at the lower side of the last row is embodied in the overall text annotation profile calculation.
It should be noted that, an operator may set appropriate relevant parameters, such as wordSpacing, lineSpacing and fontSize, to achieve different typesetting effects according to actual needs.
S11, processing line feed, automatically feeding lines when the content exceeds the boundary, and rendering the line feed when the user inputs a carriage return.
Specifically, the line feed processing can be divided into active line feed and passive line feed, wherein active line feed refers to line feed generated by actively inputting carriage return in the text input process of a user, and is represented by "\n"; passive line feed refers to line feed generated by automatically inserting line feed symbols into a character string through an algorithm and is expressed by using 'r' when the input content reaches the boundary of an application view too much; the input information is divided by line-feed symbols, character data of each line is a group, and data of all Lines are stored in an array Lines.
Rendering row data: traversing the elements in the array Lines, wherein each element is a line of data, and rendering each character of the line in a text rendering mode. If the user adjusts the position of the whole text, reprocessing the line feed, if the automatic line feed part has enough space at this time, deleting the original passive line feed symbol \r', calculating the new line feed position, and keeping the active line feed unchanged.
S12, boundary detection, namely calculating the space in the horizontal direction and the vertical direction of text addition, and if the space is insufficient, performing line feed or translation processing.
Specifically, calculating the boundary distance from the initial position coordinate of the cursor to the application view (assuming that the width is w and the height is h), calculating the distance d1=w-x in the horizontal direction, the distance d2=h-y in the vertical direction, calculating the number n of characters which can be contained in the distance d1 by combining word size, font and word spacing information, if the number of input characters exceeds n, rendering the next row from the n+1st character, wherein the initial character coordinate x of the next row uses the initial x value of the cursor, the coordinate y uses the initial y value of the cursor+word size+row spacing, and the character rendering mode of the second row is the same as that of the first row and the other rows.
And calculating the number m of rows which can be contained in the distance d2 by combining the character size, the font and the line spacing information, if the input character exceeds m rows, and after the y coordinates of the whole character move upwards by one row of distance (including the character size, the font, the line spacing and the like), rendering the character of the m+1th row to the view, ensuring that the last row can be seen, and if the y coordinates after the upward movement are smaller than 0, indicating that the upper side space of the view is not moved upwards, and prompting that the space of the user is insufficient.
S13, converting character coordinates in the application view into document coordinates in the layout document page, and converting attribute information of the characters into layout document standard attribute information for storage and rendering.
Specifically, if the user input is completed, converting character coordinates rendered in the application view into document coordinates, converting information such as color, word size, font, word spacing, line spacing and the like of the characters into attribute information of a format document standard, storing the attribute information, rendering text notes on a format document page by using the attribute information, refreshing a region added with the text notes in the format document page, and deleting rendering effects in the application view after refreshing is completed.
And S14, rendering the text annotation information into the format document page, refreshing the area where the text annotation is located in the format document page, and deleting the rendering effect in the application view after refreshing is completed.
Specifically, when the text annotation information is excessively added, a situation that the time is long may occur, in order to avoid the situation that the flicker occurs, the text annotation area may be refreshed first, and then the rendering effect in the application view may be deleted, so that the sequence cannot be reversed.
In addition, the application view can use the same character attribute information with the document so as to ensure the consistency of the two-layer rendering effect and avoid the occurrence of double images or jittering effect.
S15, judging whether to reedit, if so, entering S16; if not, the process proceeds to S19.
S16, selecting successfully added text annotation information, reading attribute information such as fonts, word sizes and coordinates, converting the information into information such as fonts, word sizes, word spacing and line spacing required by view rendering, and annotating outline information to draw frames.
Specifically, when the added text annotation information is selected, information such as color, font size, X, Y, deltaX and the like of the text annotation information is obtained from the document, the attribute information is converted into information such as color, font size, word spacing, line spacing and the like required by application view rendering, and outline information of the text annotation is used for drawing outline borders.
S17, drawing text contents and a cursor which need to be edited in the application view, hiding the rendering effect in the document page after the rendering is completed, and refreshing the region where the document annotation is located.
Specifically, the obtained text annotation information is used for rendering characters in an application view and drawing a cursor, after rendering is completed, the rendering effect in a document page is hidden, the area where the document annotation is located is refreshed, the sequence cannot be reversed, and the flickering phenomenon is avoided.
S18, editing the text content according to the cursor prompt, or reassigning the cursor position in the rendered text range, editing the text content, and returning to S11.
Specifically, after editing is completed, the text content can be restored.
S19, ending.
In the embodiment of the invention, a stable and instant realization scheme with high real-time performance is provided, so that a user can more conveniently, smoothly and efficiently add and edit text annotation information, the real-time problem in the instant text annotation adding mode is solved, the problems of jitter, flicker, inconsistent text rendering effect, ghost and the like are solved, and the technologies of boundary verification, automatic line changing, automatic page up-shifting and the like are introduced, so that the user experience of text annotation can be improved, and the user can more conveniently and smoothly add and edit the annotation information.
The text annotation rendering device based on the format document provided by the invention is described below, and the text annotation rendering device based on the format document described below and the text annotation rendering method based on the format document described above can be correspondingly referred to each other.
Fig. 4 is a schematic structural diagram of a text annotation rendering device based on a layout document according to the present invention, and as shown in fig. 4, the text annotation rendering device 400 based on a layout document includes:
a first rendering module 401, configured to respond to text annotation information input by a user, and render the text annotation information in real time in a preset application view;
A conversion module 402, configured to convert character coordinates of at least one text annotation character rendered in the application view into document coordinates in a layout document page;
a second rendering module 403, configured to render each text annotation character in the layout document page based on the document coordinates in response to the input completion instruction of the user.
Compared with the real-time problem in the related art, the text annotation rendering device based on the format document provided by the embodiment of the invention renders the text annotation information on the application view and the format document page separately, so that the text annotation information input by a user is displayed near real time, after the user confirms that the text annotation information is input through the input completion instruction, the text annotation information is rendered in the format document page with lower real time, the reading experience of the user is not disturbed in the process of inputting by the user, the interaction frequency of the application view and the format document page can be reduced, the real-time performance is improved, the problems of flickering and the like are effectively improved, the usability and the usability of the text annotation are improved, and the user experience is further improved.
Optionally, the text annotation rendering device 400 based on the layout document further includes:
a processing module for: and deleting the rendering effect in the application view after the text annotation characters are rendered in the format document page.
Optionally, the second rendering module 403 is specifically configured to:
rendering each text annotation character in the layout document page based on the document coordinates and character attribute information of each text annotation character;
the character attribute information comprises at least one of color, font size, abscissa X, character transverse dimension DeltaX, ordinate Y, character longitudinal dimension DeltaY, word spacing and line spacing of each text annotation character.
Optionally, the first rendering module 401 is further specifically configured to:
acquiring initial position coordinates of a cursor in the application view and boundary coordinates of the application view;
calculating a first distance between the cursor and a boundary of the application view based on the initial position coordinates and the boundary coordinates;
calculating the number n of characters supported and accommodated in a single row in the application view based on the first distance and the attribute information of each character in the text annotation information, wherein n is an integer greater than 0;
And in the process of rendering the text annotation information in real time, if the number of characters input by the current line in the application view is greater than n, rendering the characters greater than n on the next line of the current line.
Optionally, the first rendering module 401 is further specifically configured to:
calculating the total line number m supported and accommodated in the application view based on the first distance and the attribute information of each character in the text annotation information, wherein m is an integer greater than 0;
and in the process of rendering the text annotation information in real time, if the number of lines of the currently input characters in the application view is greater than m, moving the currently input characters upwards by p lines, wherein p is the difference value between the number of lines of the currently input characters and m.
Optionally, the first rendering module 401 is further specifically configured to:
calculating a second distance between a first row of characters in the currently input characters and an upper boundary of the application view in the process of rendering the text annotation information in real time;
and if the second distance is smaller than a preset first threshold value, stopping executing the upward movement operation on the currently input character, and outputting prompt information for representing insufficient space.
Optionally, the processing module is further configured to:
under the condition of editing text annotation characters which are rendered in the format document page, firstly acquiring the text annotation characters which are rendered in the format document page and corresponding related information;
rendering the text annotation character in the application view based on the text annotation character and corresponding related information;
after rendering is completed, hiding text annotation characters in the format document page;
responding to the editing instruction of the user, and rendering the edited text annotation characters in real time in the application view;
converting character coordinates of edited text annotation characters rendered in the application view into edited document coordinates in a layout document page;
and responding to the editing completion instruction of the user, and rendering the edited text annotation characters in the format document page based on the edited document coordinates.
Fig. 5 is a schematic structural diagram of an electronic device according to the present invention, and as shown in fig. 5, the electronic device may include: processor 510, communication interface (Communications Interface) 520, 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 a text annotation rendering method based on a layout document, the method comprising:
Responding to text annotation information input by a user, and rendering the text annotation information in real time in a preset application view;
converting character coordinates of at least one text annotation character rendered in the application view into document coordinates in a layout document page;
and responding to the input completion instruction of the user, and rendering each text annotation character in the format document page based on the document coordinates.
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 (RAM, random Access Memory), 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 text annotation rendering method based on a format document provided by the above methods, the method comprising:
responding to text annotation information input by a user, and rendering the text annotation information in real time in a preset application view;
converting character coordinates of at least one text annotation character rendered in the application view into document coordinates in a layout document page;
and responding to the input completion instruction of the user, and rendering each text annotation character in the format document page based on the document coordinates.
In yet 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 text annotation rendering method based on a layout document provided by the above methods, the method comprising:
responding to text annotation information input by a user, and rendering the text annotation information in real time in a preset application view;
Converting character coordinates of at least one text annotation character rendered in the application view into document coordinates in a layout document page;
and responding to the input completion instruction of the user, and rendering each text annotation character in the format document page based on the document coordinates.
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 text annotation rendering method based on a layout document, comprising:
responding to text annotation information input by a user, and rendering the text annotation information in real time in a preset application view;
converting character coordinates of at least one text annotation character rendered in the application view into document coordinates in a layout document page;
and responding to the input completion instruction of the user, and rendering each text annotation character in the format document page based on the document coordinates.
2. The layout document based text annotation rendering method of claim 1, wherein after the rendering of each of the text annotation characters in the layout document page based on the document coordinates, the method further comprises:
And deleting the rendering effect in the application view after the text annotation characters are rendered in the format document page.
3. The layout document-based text annotation rendering method of claim 1, wherein the rendering each of the text annotation characters in the layout document page based on the document coordinates comprises:
rendering each text annotation character in the layout document page based on the document coordinates and character attribute information of each text annotation character;
the character attribute information comprises at least one of color, font size, abscissa X, character transverse dimension DeltaX, ordinate Y, character longitudinal dimension DeltaY, word spacing and line spacing of each text annotation character.
4. The text annotation rendering method based on the layout document according to claim 1, wherein the real-time rendering of the text annotation information in the preset application view includes:
acquiring initial position coordinates of a cursor in the application view and boundary coordinates of the application view;
calculating a first distance between the cursor and a boundary of the application view based on the initial position coordinates and the boundary coordinates;
Calculating the number n of characters supported and accommodated in a single row in the application view based on the first distance and the attribute information of each character in the text annotation information, wherein n is an integer greater than 0;
and in the process of rendering the text annotation information in real time, if the number of characters input by the current line in the application view is greater than n, rendering the characters greater than n on the next line of the current line.
5. The layout document-based text annotation rendering method of claim 4, wherein after the calculating a first distance between the cursor and a boundary of the application view based on the initial position coordinates and the boundary coordinates, the method further comprises:
calculating the total line number m supported and accommodated in the application view based on the first distance and the attribute information of each character in the text annotation information, wherein m is an integer greater than 0;
and in the process of rendering the text annotation information in real time, if the number of lines of the currently input characters in the application view is greater than m, moving the currently input characters upwards by p lines, wherein p is the difference value between the number of lines of the currently input characters and m.
6. The layout document based text annotation rendering method of claim 5, further comprising:
calculating a second distance between a first row of characters in the currently input characters and an upper boundary of the application view in the process of rendering the text annotation information in real time;
and if the second distance is smaller than a preset first threshold value, stopping executing the upward movement operation on the currently input character, and outputting prompt information for representing insufficient space.
7. The layout document-based text annotation rendering method of claim 1, further comprising:
under the condition of editing text annotation characters which are rendered in the format document page, acquiring the text annotation characters which are rendered in the format document page and corresponding related information;
rendering the text annotation character in the application view based on the text annotation character and corresponding related information;
after rendering is completed, hiding text annotation characters in the format document page;
responding to the editing instruction of the user, and rendering the edited text annotation characters in real time in the application view;
Converting character coordinates of edited text annotation characters rendered in the application view into edited document coordinates in a layout document page;
and responding to the editing completion instruction of the user, and rendering the edited text annotation characters in the layout document page based on the edited document coordinates.
8. A text annotation rendering device based on a layout document, comprising:
the first rendering module is used for responding to text annotation information input by a user and rendering the text annotation information in real time in a preset application view;
the conversion module is used for converting character coordinates of at least one text annotation character rendered in the application view into document coordinates in a format document page;
and the second rendering module is used for responding to the input completion instruction of the user and rendering each text annotation character in the format document page based on the document coordinates.
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 text annotation rendering method based on a layout document as claimed in any of claims 1 to 7 when the program is executed by the processor.
10. A non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the text annotation rendering method based on a layout document according to any of claims 1 to 7.
CN202311017007.XA 2023-08-14 2023-08-14 Text annotation rendering method and device based on format document Pending CN116740235A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311017007.XA CN116740235A (en) 2023-08-14 2023-08-14 Text annotation rendering method and device based on format document

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311017007.XA CN116740235A (en) 2023-08-14 2023-08-14 Text annotation rendering method and device based on format document

Publications (1)

Publication Number Publication Date
CN116740235A true CN116740235A (en) 2023-09-12

Family

ID=87915513

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311017007.XA Pending CN116740235A (en) 2023-08-14 2023-08-14 Text annotation rendering method and device based on format document

Country Status (1)

Country Link
CN (1) CN116740235A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106843645A (en) * 2017-01-05 2017-06-13 青岛海信电器股份有限公司 A kind of method and apparatus for determining view display location
CN108038094A (en) * 2017-10-17 2018-05-15 广州视源电子科技股份有限公司 A kind of document annotation method, apparatus and electronic equipment
US10042832B1 (en) * 2015-01-16 2018-08-07 Google Llc Systems and methods for stacking marginal annotations
CN108427597A (en) * 2018-03-16 2018-08-21 崔红保 Accelerate the method and device of page rendering
CN109978972A (en) * 2019-03-20 2019-07-05 珠海天燕科技有限公司 A kind of method and device of copy editor in picture
CN111930442A (en) * 2020-10-09 2020-11-13 北京三快在线科技有限公司 Page view loading method and device, storage medium and electronic equipment
CN114816404A (en) * 2022-04-28 2022-07-29 卓望数码技术(深圳)有限公司 Method and device for dynamically rendering view page, computer equipment and storage medium
CN115292644A (en) * 2022-08-11 2022-11-04 北京沃东天骏信息技术有限公司 Page display method and device and storage medium
CN115718578A (en) * 2022-11-15 2023-02-28 深圳市华胜软件技术有限公司 Comment drawing method and device, terminal device and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10042832B1 (en) * 2015-01-16 2018-08-07 Google Llc Systems and methods for stacking marginal annotations
CN106843645A (en) * 2017-01-05 2017-06-13 青岛海信电器股份有限公司 A kind of method and apparatus for determining view display location
CN108038094A (en) * 2017-10-17 2018-05-15 广州视源电子科技股份有限公司 A kind of document annotation method, apparatus and electronic equipment
CN108427597A (en) * 2018-03-16 2018-08-21 崔红保 Accelerate the method and device of page rendering
CN109978972A (en) * 2019-03-20 2019-07-05 珠海天燕科技有限公司 A kind of method and device of copy editor in picture
CN111930442A (en) * 2020-10-09 2020-11-13 北京三快在线科技有限公司 Page view loading method and device, storage medium and electronic equipment
CN114816404A (en) * 2022-04-28 2022-07-29 卓望数码技术(深圳)有限公司 Method and device for dynamically rendering view page, computer equipment and storage medium
CN115292644A (en) * 2022-08-11 2022-11-04 北京沃东天骏信息技术有限公司 Page display method and device and storage medium
CN115718578A (en) * 2022-11-15 2023-02-28 深圳市华胜软件技术有限公司 Comment drawing method and device, terminal device and storage medium

Similar Documents

Publication Publication Date Title
US8171401B2 (en) Resizing an editable area in a web page
KR102382899B1 (en) Systems and methods of digital note taking
CN109978972B (en) Method and device for editing characters in picture
US9507520B2 (en) Touch-based reorganization of page element
US10698597B2 (en) Reflow of handwriting content
JP2016042349A (en) Automatic method for division into chapters and sections
US11687704B2 (en) Method, apparatus and electronic device for annotating information of structured document
CN104915186B (en) A kind of method and apparatus making the page
US11934774B2 (en) Systems and methods for generating social assets from electronic publications
CN109933751B (en) Image-text drawing method and device, computer-readable storage medium and computer equipment
JP2001297077A (en) Line-spacing controllable dtp system, line-spacing control method, line-spacing program, and recording medium where the same program is recorded
CN111476006B (en) PDF file online annotation method, device, equipment and readable storage medium
CN116384356B (en) Method, device, equipment and medium for creating form row of OFD file
JP2013254321A (en) Image processing apparatus, image processing method, and program
JP5974740B2 (en) Display device and display program
CN116740235A (en) Text annotation rendering method and device based on format document
CN107015738A (en) A kind of text selection method and equipment
CN111444452B (en) Webpage conversion method and device and storage medium
CN114186542A (en) Form processing method and device, electronic equipment and computer readable storage medium
KR102432916B1 (en) Method and device for providing fonts
CN111126007B (en) HTM L-based medical record document paging algorithm
CN113378526A (en) PDF paragraph processing method, device, storage medium and equipment
KR20150085282A (en) Operating method of terminal for correcting electronic document
CN106598934A (en) Electronic book data display method and device, and terminal equipment
CN116090417B (en) Layout document text selection rendering method and device, electronic equipment and storage medium

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