Program text processing method and device

By creating embedded windows in the program save page and converting text components into text images, the high concurrency performance problems caused by too long or too much text in the LED display industry are solved, improving response rate and user experience.

CN114065705BActive Publication Date: 2024-12-17XIAN NOVASTAR TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010759924.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-31
Publication Date
2024-12-17
Estimated Expiration
2040-07-31

AI Technical Summary

Technical Problem

In the LED display industry, when users add too long or too much text when producing programs, the existing technology will lead to high concurrency performance problems, resulting in long wait times and affecting the user experience.

Method used

By creating an embedded window in the program save page, obtaining the text components in the program, generating text fragments of the document object model, and using the embedded window to convert it into text pictures, replacing the original text components, avoiding the number of text fragments of the document object model Blocking problem when the number of embedded windows is greater than the number of embedded windows.

Benefits of technology

Improves the response rate, reduces the waiting time, improves the user experience, and solves the problem of high concurrency performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114065705B_ABST
    Figure CN114065705B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method and device for processing program text. The method includes the following steps: creating an embedded window in a program saving page; obtaining a text component in a program; generating a document object model text fragment according to the text component; sending the document object model text fragment to the embedded window; using the embedded window to generate at least one text image according to the document object model text fragment; replacing the text component with at least one text image. This embodiment realizes the conversion of text components into text images, solves the problem of high concurrency performance, improves the response rate, and greatly improves the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of multimedia control and playback, and in particular to a program text processing method and a program text processing device. Background Art

[0002] In the LED display industry, users generally add text when making programs. In the existing technology, when the program is released, the WEB front end will crop the text according to the scrolling mode (such as page turning or static) and the preset text preview size. However, when the text is too long or there is too much text, high concurrency performance problems will occur, resulting in long waiting time and affecting the user experience. Summary of the invention

[0003] Therefore, in order to overcome at least some of the defects and shortcomings in the prior art, the embodiments of the present invention provide a program text processing method and a program text processing device to solve the high concurrency performance problem during program text processing, reduce waiting time, and improve user experience.

[0004] On the one hand, an embodiment of the present invention provides a program text processing method, including: creating an embedded window in a program save page; obtaining text components in the program; generating a document object model text fragment based on the text component; sending the document object model text fragment to the embedded window; using the embedded window to generate at least one text image based on the document object model text fragment; replacing the text component with at least one of the text images.

[0005] The program text processing method provided in this embodiment creates an embedded window in the program saving page, obtains the text components in the program, generates a document object model text fragment according to the text components, uses the embedded window to generate at least one text image according to the document object model text fragment, replaces the text component with at least one text image, and realizes the conversion of the text component into a text image, thereby solving the high concurrency performance problem, improving the response rate, and improving the user experience.

[0006] In one embodiment of the present invention,

[0007] The text component includes a text box and text content; generating a document object model text fragment based on the text component specifically includes: cropping the text content according to the width and height of the text box to obtain at least one document object model text fragment, wherein the width and height of the document object model text fragment are consistent with the width and height of the text box.

[0008] In one embodiment of the present invention, the use of the embedded window to generate at least one text image according to the document object model text fragment specifically includes: using the embedded window to generate a corresponding fragment text on the embedded window according to the document object model text fragment; taking a screenshot of the fragment text to generate at least one text image corresponding to the text component.

[0009] In one embodiment of the present invention, the document object model text fragment includes a first document object model text fragment; the embedded window includes a first embedded window; the using of the embedded window to generate at least one text image according to the document object model text fragment specifically includes: generating a first fragment text in the first embedded window according to the first document object model text fragment; taking a screenshot of the first fragment text to generate a first text image.

[0010] In one embodiment of the present invention, the document object model text fragment also includes a second document object model text fragment; the use of the embedded window to generate at least one text image according to the document object model text fragment also includes: in response to generating the first text image, generating a second fragment text in the first embedded window according to the second document object model text fragment; and taking a screenshot of the second fragment text to generate a second text image.

[0011] The program text processing method provided in this embodiment performs the operation of generating a second text image after completing the operation of generating a first text image in the first embedded window. In this way, the problem of blocking that is easily caused when the number of document object model text fragments is greater than the number of embedded windows is avoided, and the processing response rate is improved.

[0012] On the other hand, an embodiment of the present invention provides a program text processing device, including: a creation module, used to create an embedded window in a program save page; an acquisition module, used to acquire text components in the program; a first generation module, used to generate a document object model text fragment based on the text component; a sending module, used to send the document object model text fragment to the embedded window; a second generation module, used to generate at least one text image based on the document object model text fragment using the embedded window; and a replacement module, used to replace the text component with at least one of the text images.

[0013] The program text processing device of this embodiment is provided with a creation module, an acquisition module, a first generation module, a sending module, a second generation module and a replacement module, so that an embedded window can be created in the program saving page to acquire the text components in the program, generate a document object model text fragment according to the text components, use the embedded window to generate at least one text image according to the document object model text fragment, replace the text component with at least one text image, and realize the conversion of the text component into a text image, thereby solving the problem of high concurrency performance, improving the response rate, and improving the user experience.

[0014] In one embodiment of the present invention, the text component includes a text box and text content; the first generation module is specifically used to: crop the text content according to the width and height of the text box to obtain at least one document object model text fragment, wherein the width and height of the document object model text fragment are consistent with the width and height of the text box.

[0015] In one embodiment of the present invention, the second generation module specifically includes: a first generation unit, used to use the embedded window to generate corresponding fragment text on the embedded window according to the document object model text fragment; a second generation unit, used to perform a screenshot operation on the fragment text to generate at least one text image corresponding to the text component.

[0016] In one embodiment of the present invention, the document object model text fragment includes a first document object model text fragment; the embedded window includes a first embedded window; the second generation module specifically includes: a third generation unit, used to generate a first fragment text in the first embedded window based on the first document object model text fragment; a fourth generation unit, used to take a screenshot of the first fragment text to generate a first text image.

[0017] In one embodiment of the present invention, the document object model text fragment also includes a second document object model text fragment; the second generation module also includes: a fifth generation unit, used to generate a second fragment text in the first embedded window according to the second document object model text fragment in response to generating the first text image; a sixth generation unit, used to perform a screenshot operation on the second fragment text to generate a second text image.

[0018] On the other hand, an embodiment of the present invention provides a program text processing system, comprising: a memory and a processor connected to the memory, the processor storing a computer program, and the processor executing the program text processing method as described above when running the computer program.

[0019] On the other hand, an embodiment of the present invention provides a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the stored computer program is executed by a processor, the program text processing method as described above can be implemented.

[0020] One or more of the above-mentioned technical solutions may have the following advantages or beneficial effects: by creating an embedded window in the program saving page, obtaining the text components in the program, generating a document object model text fragment according to the text components, using the embedded window to generate at least one text image according to the document object model text fragment, replacing the text component with at least one of the text images, and realizing the conversion of the text component into a text image, the problem of high concurrency performance is solved, the response rate is improved, and the user experience is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0022] Figure 1 A flowchart of a program text processing method provided by the first embodiment of the present invention.

[0023] Figure 2 for Figure 1 Schematic diagram of the process of step S50.

[0024] Figure 3 for Figure 1 Partial flow chart of step S50 in FIG.

[0025] Figure 4 for Figure 1 Another flowchart diagram of step S50 in FIG.

[0026] Figure 5 Schematic diagram of the effect of saving the program page.

[0027] Figure 6 A schematic diagram of modules of a program text processing device provided in the second embodiment of the present invention.

[0028] Figure 7 for Figure 6 Schematic diagram of the process flow of the second generation module.

[0029] Figure 8 for Figure 6 Schematic diagram of part of the flow chart of the second generation module.

[0030] Fig. 9 for Figure 6 Another flow chart of the second generation module in FIG.

[0031] Fig.10 A schematic diagram of the structure of a program text processing system provided in the third embodiment of the present invention.

[0032] Fig.11 A schematic structural diagram of a computer-readable storage medium provided for the fourth embodiment of the present invention. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0034] [First embodiment]

[0035] like Figure 1 As shown, a program text processing method provided by the first embodiment of the present invention includes the following steps:

[0036] S10, creating an embedded window in the program saving page;

[0037] S20, obtaining a text component in the program;

[0038] S30, generating a document object model text segment according to the text component;

[0039] S40, sending the document object model text segment to the embedded window;

[0040] S50, generating at least one text image according to the document object model text segment using the embedded window;

[0041] S60: Replace the text component with at least one of the text images.

[0042] The text components are text boxes and text content; the step S30 of generating a document object model text segment according to the text components specifically includes:

[0043] The text content is cropped according to the width and height of the text box to obtain the document object model text segment, wherein the width and height of the document object model text segment are consistent with the width and height of the text box.

[0044] See also Figure 2The step S50 of using the embedded window to generate a text image according to the document object model text segment specifically includes:

[0045] S51, using the embedded window to generate a corresponding segment text on the embedded window according to the document object model text segment;

[0046] S52: Taking a screenshot of the text segment to generate at least one text image corresponding to the text component.

[0047] See also Figure 3 , the document object model text segment includes a first document object model text segment; the inline window includes a first inline window; step S50 of using the inline window to generate at least one text image according to the document object model text segment specifically includes:

[0048] S53, generating a first segment text in the first embedded window using the first document object model text segment;

[0049] S54: taking a screenshot of the first text segment to generate a first text image.

[0050] See also Figure 4 , the document object model text segment also includes a second document object model text segment; step S50 of using the embedded window to generate at least one text image according to the document object model text segment also includes:

[0051] S55, in response to generating the first text image, generating a second segment text in the first embedded window according to the second document object model text segment;

[0052] S56: taking a screenshot of the second text segment to generate a second text image.

[0053] The program text processing method provided in this embodiment can be implemented, for example, by browser software installed on a personal computer. In order to facilitate a clearer understanding of this embodiment, the program text processing method of this embodiment is described in detail below.

[0054] Specifically, see Figure 5 , the user can, for example, edit the program on the program editing page of the browser software on the personal computer, and when the program editing is completed and the program is saved, on the program saving page (such as Figure 5 As shown in FIG. 1 , an embedded window is created in the current page, which may be, for example, a first embedded window. Here, one embedded window is only an example. Of course, multiple embedded windows may also be created. Specifically, the embedded window may be implemented, for example, by using iframe technology. Of course, the embodiment of the present invention is not limited thereto.

[0055] According to the above, the text component in the program is obtained. The text component may include a text box and text content, for example. The text box has a width and a height, specifically the width and height of the text display of the program. The height and width of the text box may be adjusted by the user through parameter adjustment or dragging on the program editing page of the personal computer browser software. After the text component of the program is obtained, the text content may be cut according to the width and height of the text box to generate two document object model text fragments (i.e., DOM text fragments). The two document object model text fragments may include, for example, a first document object model text fragment and a second document object model text fragment. Here, two document object model text fragments are taken as an example. Of course, it can also be one or more, and the embodiment of the present invention is not limited to this. Specifically, the text content may be cut according to the width and height of the text box to generate a DOM text fragment array, and the unique identifier of the text component, such as ID, is used as a keyword (key), and the DOM text fragment array is used as a value (value) to form a text object. The document object model text fragment may exist in the form of a text object, for example. Of course, this is only an example, and the embodiment of the present invention is not limited to this.

[0056] The first document object model text segment is sent to the first embedded window. The first embedded window generates a first segment text in the first embedded window according to the first document object model text segment. Specifically, the first document object model text segment may include display width, height, text segment content, text attributes, etc. The text segment content is displayed on the first embedded window according to the display width, height, text attributes, etc. to form the first segment text. A screenshot operation is performed on the first segment text displayed on the first embedded window to generate a corresponding first text image. The screenshot operation here can be implemented by a screenshot method in the prior art, such as by using canvas technology, which will not be described here. After the first text image is generated, the second document model text segment is continued to be sent to the first embedded window. The first embedded window generates a second text segment on the first embedded window according to the second document model text segment. A screenshot operation is performed on the second text segment to generate a corresponding second text image. Through the above operation, the conversion of the text component into a text image is completed. For example, the text component in the program can be replaced with the first text image and the second text image and the picture set corresponding to the text component to be sent down for playback.

[0057] In a specific implementation of an embodiment of the present invention, for example, five embedded windows can be created. For example, when the number of DOM text fragments is large, for example, greater than five, a number of DOM text fragments is first sent to each embedded window to generate a text image, and then it is determined which embedded window generates the text image first, and then a new DOM text fragment is distributed to this embedded window until all DOM text fragments generate corresponding text images. Performance can be improved by five embedded windows, and the stability of the server is guaranteed. Of course, the number of embedded windows can also be one or more, as long as the performance is met, and the embodiment of the present invention is not limited to this. In addition, after all document object model text fragments generate corresponding images, the created embedded windows are released. The conversion of text components into images is achieved by creating embedded windows, because although a browser page is a JS thread, multiple embedded windows can be created based on a browser page. In this way, multiple embedded windows use one JS thread, which solves the problem of high concurrency performance and improves the response rate.

[0058] It is worth mentioning that the created embedded window is hidden from the user, that is, it is not displayed in the program saving interface. In this way, the user will not see the image generation process, reducing the impact on the user experience.

[0059] In summary, the program text processing method of this embodiment creates an embedded window in the program saving page, obtains the text component in the program, generates a document object model text fragment according to the text component, uses the embedded window to generate at least one text image according to the document object model text fragment, replaces the text component with at least one text image, and realizes the conversion of the text component into a text image, thereby solving the high concurrency performance problem, improving the response rate, and improving the user experience. In addition, in the browser page, i.e., the program saving page, the text component is converted into a text image by creating an embedded window, and the font library used is consistent with the font library when the program editing page creates the text, so there will be no difference when generating the image, and the display effect can be guaranteed.

[0060] [Second embodiment]

[0061] like Figure 6 As shown, the second embodiment of the present invention provides a program text processing device 100. The program text processing device 100 includes, for example, a creation module 110, an acquisition module 120, a first generation module 130, a sending module 140, a second generation module 150 and a replacement module 160.

[0062] The creation module 110 is used to create an embedded window in the program saving page.

[0063] The acquisition module 120 is used to acquire text components in the program.

[0064] The first generating module 130 is used to generate a document object model text segment according to the text component.

[0065] The sending module 140 is used to send the document object model text segment to the embedded window.

[0066] The second generating module 150 is configured to generate at least one text image according to the document object model text segment by using the embedded window.

[0067] The replacement module 160 is used to replace the text component with at least one of the text pictures.

[0068] The text component includes a text box and text content; the first generating module 130 is specifically used for:

[0069] The text content is cropped according to the width and height of the text box to obtain the document object model text segment, wherein the width and height of the document object model text segment are consistent with the width and height of the text box.

[0070] See also Figure 7 The second generating module 150 specifically includes a first generating unit 151 and a second generating unit 152.

[0071] The first generating unit 151 is configured to generate a corresponding segment text on the inline window according to the document object model text segment by using the inline window.

[0072] The second generating unit 152 is used to perform a screenshot operation on the text segment to generate at least one text image corresponding to the text component.

[0073] See also Figure 8 , the document object model text segment includes a first document object model text segment; the inline window includes a first inline window; the second generating module 150 specifically includes:

[0074] The third generating unit 153 is configured to generate a first segment text in the first embedded window by using the first document object model text segment.

[0075] The fourth generating unit 154 is used to perform a screenshot operation on the first text segment to generate a first text image.

[0076] See also Fig. 9 , the document object model text segment also includes a second document object model text segment; the second generation module 150 also includes a fifth generation unit 155 and a sixth generation unit 156.

[0077] The fifth generating unit 155 is configured to generate a second segment text in the first inline window according to the second document object model text segment in response to generating the first text image.

[0078] The sixth generating unit 156 is configured to perform a screenshot operation on the second text segment to generate a second text image.

[0079] The specific working process and technical effects of the modules in the program text processing device 100 in this embodiment refer to the description of the first embodiment above, which will not be repeated here.

[0080] [Third embodiment]

[0081] like Fig.10 As shown, the third embodiment of the present invention provides a program text processing system 200. The program text processing system 200 includes, for example, a memory 220 and a processor 210 connected to the memory 220. The memory 220 may be, for example, a non-volatile memory on which a computer program 221 is stored. The processor 210 may be, for example, an embedded processor. When the processor 210 runs the computer program 221, the program text processing method in the first embodiment described above is executed.

[0082] The specific working process and technical effects of the program text processing system 200 in this embodiment refer to the description of the first embodiment mentioned above.

[0083] [Fourth embodiment]

[0084] like Fig.11 As shown, the fourth embodiment of the present invention provides a computer-readable storage medium 300. The computer-readable storage medium 300 is, for example, a non-volatile memory, which is, for example: a magnetic medium (such as a hard disk, a floppy disk, and a magnetic tape), an optical medium (such as a CDROM disk and a DVD), a magneto-optical medium (such as an optical disk), and a hardware device specially constructed to store and execute computer-executable instructions (such as a read-only memory (ROM), a random access memory (RAM), a flash memory, etc.). Computer-executable instructions 310 are stored on the computer-readable storage medium 300. The computer-readable storage medium 300 can be executed by one or more processors or processing devices to execute the computer-executable instructions 310 to implement the program text processing method in the aforementioned first embodiment.

[0085] In addition, it can be understood that the aforementioned embodiments are only exemplary descriptions of the present invention. Under the premise that the technical features do not conflict, the structures do not contradict, and the purpose of the present invention is not violated, the technical solutions of the various embodiments can be arbitrarily combined and used in combination.

[0086] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0087] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0088] In addition, each functional unit / module in each embodiment of the present invention may be integrated into one processing unit / module, or each unit / module may exist physically separately, or two or more units / modules may be integrated into one unit / module. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of hardware plus software functional units / modules.

[0089] The above-mentioned integrated unit / module implemented in the form of a software functional unit / module can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for enabling one or more processors of a computer device (which can be a personal computer, a server, or a network device, etc.) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store program codes.

[0090] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A program text processing method, characterized in that: include: Create an embedded window in the program save page; Get the text component in the program; Generate a document object model text segment according to the text component; Sending the document object model text fragment to the embedded window; generating at least one text image according to the document object model text segment using the embedded window; Replacing the text component with at least one of the text images; Wherein, there are multiple embedded windows and multiple document object model text segments; the method further includes: Sending one of the multiple document object model text segments to multiple inline windows respectively, and determining the inline window that generates the text image first among the multiple inline windows; The remaining DOM text segments among the multiple DOM text segments are sent to the embedded window that generates the text image first for processing, and a corresponding text image is generated.

2. The program text processing method according to claim 1, characterized in that: The text component includes a text box and text content; and generating a document object model text segment according to the text component specifically includes: The text content is cropped according to the width and height of the text box to obtain at least one of the document object model text segments, wherein the width and height of the document object model text segment are consistent with the width and height of the text box.

3. The program text processing method according to claim 1, characterized in that: The step of generating at least one text image according to the document object model text segment by using the embedded window specifically includes: Using the embedded window, generating corresponding fragment text on the embedded window according to the document object model text fragment; A screenshot operation is performed on the text segment to generate at least one text image corresponding to the text component.

4. The program text processing method according to claim 1, characterized in that: The document object model text segment includes a first document object model text segment; the inline window includes a first inline window; and the step of generating at least one text image according to the document object model text segment by using the inline window specifically includes: Generate a first fragment text in the first embedded window according to the first document object model text fragment; A screenshot operation is performed on the first text segment to generate a first text image.

5. The program text processing method according to claim 4, characterized in that: The document object model text segment further includes a second document object model text segment; and the generating at least one text image according to the document object model text segment by using the embedded window further includes: In response to generating the first text image, generating a second segment text in the first inline window according to the second document object model text segment; A screenshot operation is performed on the second text segment to generate a second text image.

6. A program text processing device, characterized in that: include: Create a module for creating an embedded window in the program saving page; An acquisition module is used to acquire text components in a program; A first generating module, used for generating a document object model text segment according to the text component; A sending module, used for sending the document object model text segment to the embedded window; A second generating module, configured to generate at least one text image according to the document object model text segment using the embedded window; A replacement module, used to replace the text component with at least one of the text pictures; Among them, there are multiple embedded windows and multiple document object model text fragments; the device is also used to: send one of the multiple document object model text fragments to multiple embedded windows respectively, and determine the order in which the multiple embedded windows generate text images; send the remaining document object model text fragments among the multiple document object model text fragments to the embedded window that generates the text image first for processing, and generate the corresponding text image.

7. The program text processing device according to claim 6, characterized in that: The text component includes a text box and text content; the first generating module is specifically used for: The text content is cropped according to the width and height of the text box to obtain at least one of the document object model text segments, wherein the width and height of the document object model text segment are consistent with the width and height of the text box.

8. The program text processing device according to claim 6, characterized in that: The second generation module specifically includes: A first generating unit, configured to generate a corresponding segment text on the inline window according to the document object model text segment by using the inline window; The second generating unit is used to perform a screenshot operation on the text segment to generate at least one text image corresponding to the text component.

9. The program text processing device according to claim 6, characterized in that: The document object model text segment includes a first document object model text segment; the inline window includes a first inline window; and the second generating module specifically includes: A third generating unit, configured to generate a first segment text in the first embedded window using the first document object model text segment; The fourth generating unit is used to perform a screenshot operation on the first text segment to generate a first text image.

10. The program text processing device according to claim 9, characterized in that: The document object model text segment also includes a second document object model text segment; and the second generating module also includes: a fifth generating unit, configured to generate a second segment text in the first inline window according to the second document object model text segment in response to generating the first text image; The sixth generating unit is used to perform a screenshot operation on the second text segment to generate a second text image.