CN115146608B - Content typesetting method, device, equipment and storage medium - Google Patents

Content typesetting method, device, equipment and storage medium Download PDF

Info

Publication number
CN115146608B
CN115146608B CN202210522143.3A CN202210522143A CN115146608B CN 115146608 B CN115146608 B CN 115146608B CN 202210522143 A CN202210522143 A CN 202210522143A CN 115146608 B CN115146608 B CN 115146608B
Authority
CN
China
Prior art keywords
typesetting
chapter
target
preset
result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210522143.3A
Other languages
Chinese (zh)
Other versions
CN115146608A (en
Inventor
张玮维
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Douyin Vision Co Ltd
Original Assignee
Douyin Vision 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 Douyin Vision Co Ltd filed Critical Douyin Vision Co Ltd
Priority to CN202210522143.3A priority Critical patent/CN115146608B/en
Publication of CN115146608A publication Critical patent/CN115146608A/en
Application granted granted Critical
Publication of CN115146608B publication Critical patent/CN115146608B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/189Automatic justification

Landscapes

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

Abstract

The present disclosure relates to a content typesetting method, apparatus, device, and storage medium. The content typesetting method comprises the following steps: if the chapter typesetting triggering operation is detected, acquiring target chapter data; analyzing and typesetting the target chapter data according to a preset typesetting processing unit to generate an initial typesetting result; the preset typesetting processing unit is an integer multiple of a tag mark unit in the target chapter data, and is smaller than one chapter; and if the length of the initial typesetting result reaches the preset display processing unit, generating a target typesetting result based on the initial typesetting result. According to the embodiment of the disclosure, the data analysis and the data typesetting in the typesetting process can be improved from the original serial implementation mode to the concurrent implementation mode of analyzing and typesetting at the same time, so that the waiting time of data analysis is saved, the waiting time of content typesetting is greatly shortened, the content display speed of the electronic book is improved, and the user experience is further improved.

Description

Content typesetting method, device, equipment and storage medium
Technical Field
The disclosure relates to the technical field of electronic books, and in particular relates to a content typesetting method, device, equipment and storage medium.
Background
With the popularization of intelligent devices, electronic books are becoming a mainstream form of reading books for the public.
Currently, content display of electronic books is handled in chapter units. Therefore, when the content of the electronic book is redisplayed every time the electronic book is triggered, the content of the whole chapter is completely rearranged and then displayed to the user after the rearrangement is completed, so that the user needs to wait for a long time every time, and the reading experience of the user is poor.
Disclosure of Invention
In order to solve the technical problems, the present disclosure provides a content typesetting method, device, equipment and storage medium.
In a first aspect, the present disclosure provides a content typesetting method, the method including:
if the chapter typesetting triggering operation is detected, acquiring target chapter data;
analyzing and typesetting the target chapter data according to a preset typesetting processing unit to generate an initial typesetting result; the preset typesetting processing unit is an integer multiple of a tag mark unit in the target chapter data, and is smaller than one chapter;
And if the length of the initial typesetting result is determined to reach a preset display processing unit, generating a target typesetting result based on the initial typesetting result.
In a second aspect, the present disclosure provides a content typesetting apparatus, the apparatus comprising:
The target chapter data acquisition unit is used for acquiring target chapter data if chapter typesetting triggering operation is detected;
The initial typesetting result generation unit is used for analyzing and typesetting the target chapter data according to a preset typesetting processing unit to generate an initial typesetting result; the preset typesetting processing unit is an integer multiple of a tag mark unit in the target chapter data, and is smaller than one chapter;
And the target typesetting result generating unit is used for generating a target typesetting result based on the initial typesetting result if the length of the initial typesetting result reaches a preset display processing unit.
In a third aspect, the present disclosure provides an electronic device comprising:
a processor;
a memory for storing executable instructions;
The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the content typesetting method described in any embodiment of the disclosure.
In a fourth aspect, the present disclosure provides a computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to implement the content typesetting method described in any of the embodiments of the present disclosure.
According to the content typesetting method, device, equipment and storage medium, target chapter data can be obtained under the condition that chapter typesetting triggering operation is detected, the target chapter data are analyzed and typeset according to the preset typesetting processing unit smaller than one chapter, an initial typesetting result is generated, and under the condition that the length of the initial typesetting result reaches the preset display processing unit, the target typesetting result is generated based on the initial typesetting result; the method has the advantages that the data analysis logic and the data typesetting logic in the content typesetting process are decoupled, the original serial implementation mode of data analysis and data typesetting is improved to the concurrent implementation mode of analysis-while-typesetting, the waiting time of data analysis is saved, the waiting time of the content typesetting is greatly shortened, the content display speed of the electronic book is improved, and the user experience is further improved.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
Fig. 1 is a schematic flow chart of a content typesetting method according to an embodiment of the disclosure;
fig. 2 is a flow chart of another content typesetting method according to an embodiment of the disclosure;
Fig. 3 is a flowchart of another content typesetting method according to an embodiment of the present disclosure;
Fig. 4 is a schematic structural diagram of a content typesetting device according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
In the related art, the content typesetting and displaying of the electronic book are performed in units of chapters, and the process flow may be as shown in fig. 1: firstly, downloading book data of the whole chapter, then analyzing the book data of the whole chapter, typesetting the analyzed data to obtain typesetting page data, and finally rendering and displaying each typesetting page data. The content display mode needs to be displayed to the user after the whole chapter book data are processed, so that the user needs to wait for a long time. For chapters with longer content, the waiting time is longer, resulting in poor reading experience for the user.
Based on the above situation, the embodiment of the disclosure provides a content typesetting method, so as to reduce a processing unit of content typesetting of an electronic book from a chapter to a preset typesetting processing unit, so as to reduce time consumption in the typesetting process, thereby presenting the content of the electronic book to a user more quickly and improving reading experience of the user.
The content typesetting method provided by the embodiment of the disclosure can be suitable for a scene for typesetting and displaying the reading content. The method may be performed by a content typesetting apparatus, which may be implemented in software and/or hardware, which may be integrated in an electronic device, which may include, but is not limited to, mobile terminals such as smartphones, personal digital assistants (Personal DIGITAL ASSISTANT, PDA), tablet computers (Tablet Personal Computer, tablet PCs), notebook computers, PMPs (portable multimedia players), vehicle terminals (e.g., vehicle navigation terminals), wearable devices, etc., and stationary terminals such as digital televisions, desktop computers, etc.
Fig. 2 shows a flow chart of a content typesetting method according to an embodiment of the present disclosure. As shown in fig. 2, the content typesetting method may include the steps of:
S210, if the chapter typesetting triggering operation is detected, acquiring target chapter data.
The chapter typesetting triggering operation is an operation for triggering typesetting processing on a chapter of the electronic book. The electronic book in the embodiment of the disclosure can be a digital version of a formal book, or can be a digital reading content of an informal book, but distinguishing chapters. The target chapter data are related data of the target chapter corresponding to the chapter typesetting triggering operation. The data format of the target chapter data matches the edit format of the electronic book. For example, the electronic book is edited in hypertext markup language (Hypertext Markup Language, HTML), and then the target chapter data is an HTML document.
Specifically, the electronic device detects various trigger operations received by the user during the process of reading the electronic book by using the electronic device. For example, the electronic device may detect various trigger operations performed by the user, and may also detect various instructions issued by the server. If the electronic device detects a chapter type setting trigger operation, the electronic device may perform a corresponding content type setting procedure in response to the chapter type setting trigger operation. In the content typesetting process, the electronic device first acquires the target chapter data. For example, the electronic device may obtain the target chapter data from the network side download; as another example, the electronic device may read and obtain the target chapter data from an internal storage medium or an external storage medium.
In some embodiments, the chapter type setting triggering operation includes at least one of a first start book operation, a restart book operation, a switch read chapter operation, and a push information processing instruction.
The first book starting operation refers to an operation of opening the electronic book for the first time. The operation of restarting the electronic book refers to an operation of opening the electronic book for the first time, that is, an operation of exiting the electronic book for reading after the electronic book is opened for the first time, and then opening the electronic book again. The operation of switching the reading chapter refers to an operation of switching the reading chapter in the electronic book, which may be an operation of finishing reading a chapter and continuing reading by a user, an operation of selecting a chapter by a chapter title by a user, an operation of changing the reading chapter by dragging/clicking a reading progress bar, modifying a reading progress percentage, and the like by a user, and the like. The push information processing instruction is an instruction for inserting push information or closing push information in a read page, and may be an instruction issued by a server, or may be an instruction generated according to related operations (such as an operation for closing push information, an operation for setting whether push information is displayed or not, etc.) of a user.
Specifically, the electronic device can be triggered to re-typeset the target chapter by the first book starting operation, the book restarting operation, the chapter reading switching operation and the pushing information processing instruction. Therefore, in this embodiment, the electronic device may consider that the electronic device detects the chapter composition triggering operation when detecting any one, any two, any three, or four of the first start book operation, the restart book operation, the switch read chapter operation, and the push information processing instruction.
S220, analyzing and typesetting the target chapter data according to a preset typesetting processing unit, and generating an initial typesetting result.
The preset typesetting processing unit is a preset data processing unit for typesetting contents. In the embodiment of the disclosure, the preset typesetting processing unit is an integer multiple of a tag mark unit in the target chapter data, and the preset typesetting processing unit is smaller than one chapter. The tag mark unit here refers to a book unit marked by a content tag set in the edit format of the electronic book. For example, if the book unit marked by the tag in the HTML document is one paragraph, the preset typesetting processing unit is smaller than one paragraph but greater than or equal to 1 paragraph. The initial typesetting result is a typesetting result generated after the electronic equipment executes one typesetting operation.
Specifically, the content typesetting method in the related art is processed in units of chapters, and the data typesetting operation needs to be executed after the completion of the data analysis operation, which takes a long time. Based on this, in the embodiment of the disclosure, the processing unit of typesetting of the content is reduced from one chapter to a preset typesetting processing unit, so as to reduce the time consumption in the typesetting process.
In specific implementation, the electronic equipment analyzes and typesets the target chapter data in batches according to a preset typesetting processing unit. The electronic equipment analyzes the chapter data of a preset typesetting processing unit each time, and typesets the analyzed chapter data of the preset typesetting processing unit each time. Thus, the typesetting data obtained by each typesetting is the initial typesetting result. In the process, the typesetting data of the last typesetting operation can be continuously overlapped and typeset on the typesetting data of the previous typesetting operation, so that the initial typesetting result is updated once when the typesetting operation is executed once.
In some embodiments, the preset typesetting processing unit is preset to a fixed value in the value range. The value range is a section lower limit value and a section upper limit value, namely the value range is more than or equal to 1 section and less than one section, and the value range is a label mark unit and a section left-closing right-opening section. For example, the preset typesetting processing unit may be preset as 2 paragraphs, and is fixed during the reading of the whole book.
In other embodiments, the preset typesetting processing unit is determined based on the preset adjustment condition and the value range, that is, the preset typesetting processing unit performs adaptive adjustment within the value range according to the preset adjustment condition. The value range is a section lower limit value and a section upper limit value which are respectively a label mark unit and a left-closing right-opening section of one section, namely the value range is more than or equal to 1 section and less than one section. It will be appreciated that the preset typesetting processing units in this embodiment are variable throughout the reading of the book.
The preset adjustment condition includes at least one of the number of paragraphs included in the target chapter data, a user reading speed, a user waiting threshold, and a processor performance. For example, the smaller the number of paragraphs, the smaller the preset typesetting processing unit is in order to satisfy the requirement of less than one chapter; the faster the user reads, the faster the electronic device displays the content, so that the user can less perceive the card, and the smaller the value of the preset typesetting processing unit is; the user waiting threshold is used for representing the tolerance degree of the user to the waiting time, the lower the user tolerance degree is, the lower the user waiting threshold is, and the faster the content display speed of the electronic equipment is in order to improve the user experience, so that the smaller the value of the preset typesetting processing unit is; the worse the performance of the processor, the slower the typesetting speed of the electronic equipment, and the smaller the value of the preset typesetting processing unit. The user wait threshold may be obtained from user behavior data authorized by the user. For example, statistics may be made by user behavior data authorized by the user, such as the frequency with which the user exits while waiting for the content to be displayed, the frequency of refresh operations, the frequency with which the screen is clicked, and so forth.
Illustratively, the preset typesetting processing unit is one paragraph. Based on the description of the above embodiments, in order to be compatible with various situations and to increase the typesetting speed, the preset typesetting processing unit may be set as one paragraph.
And S230, if the length of the initial typesetting result reaches the preset display processing unit, generating a target typesetting result based on the initial typesetting result.
The preset display processing unit is a preset data processing unit for displaying contents. The preset display processing unit is an integer multiple of a displayed page, and the displayed page is a page adapting to the size of the typesetting area. The layout area is an area for displaying the reading content, which is preset, and may be, for example, a screen of the electronic device. For example, in order to increase the display speed, the preset display processing unit is one page of the adapted layout area size. The target typesetting result is typesetting page data for rendering display.
Specifically, the electronic device finally presents the book content in the display page, so the target typesetting result finally generated by the electronic device is in units of pages, that is, the target typesetting result is composed of at least one typesetting page data. However, in order to balance the layout speed and the device performance, the operation execution unit of the electronic device that generates the target layout result is a preset display processing unit.
In the implementation, the electronic device may compare the typesetting length of the initial typesetting result with the preset display processing unit in the process of generating the initial typesetting result. If the comparison result is that the length of the initial layout result is less than the preset display processing unit, the layout operation of S220 is continued. If the comparison result is that the length of the initial typesetting result is greater than or equal to the preset display unit, generating a target typesetting result by utilizing the part of the initial typesetting result which just reaches the preset display processing unit.
For example, if the preset display processing unit is a page, a target typesetting result is generated when the initial typesetting result is full of a page, and the target typesetting result contains typesetting page data.
For another example, if the preset display processing unit is two pages, the operation of generating the target typesetting result is triggered and executed only when the initial typesetting result is full of the two pages, and the generated target typesetting result contains two typesetting page data.
In some embodiments, in a case where the preset display processing unit is one page of the adapted layout area size, determining that the length of the initial layout result reaches the preset display processing unit includes: if the coordinate difference value between the display coordinates of the target row in the initial typesetting result and the tail edge coordinates of the typesetting area in the column direction is smaller than a preset length threshold value, determining that the length of the initial typesetting result reaches a preset display processing unit.
The target line is a line in the initial typesetting result, and may be a line in the initial typesetting result, a line just typeset, or a last line of the typesetting operation. The column direction is perpendicular to the row direction corresponding to the target row, and the row direction is a direction with an included angle smaller than a preset angle threshold (empirical value) with the horizontal direction. The preset length threshold is a preset length threshold, which may be a height value corresponding to one line or a height value of an area occupied by the displayed recommended information.
Specifically, in the process of generating an initial typesetting result, the electronic device calculates the difference between the display coordinates of the target row in the typesetting area and the tail edge coordinates of the typesetting area to obtain a coordinate difference value, and compares the coordinate difference value with a preset length threshold value. If the coordinate difference value is greater than or equal to the preset length threshold value, which indicates that the reading content can be typeset continuously in the typesetting area, S220 is executed continuously. If the coordinate difference value is smaller than the preset length threshold value, indicating that one line of reading content cannot be typeset in the typesetting area, determining that the length of the initial typesetting result reaches a preset display processing unit. The setting has the advantages that the typesetting condition of the content containing the pictures or the videos in the read content can be well considered, and the accuracy of the typesetting of the content is improved.
According to the content typesetting method provided by the embodiment of the disclosure, under the condition that the chapter typesetting triggering operation is detected, target chapter data can be obtained, the target chapter data are analyzed and typeset according to the preset typesetting processing unit smaller than one chapter, an initial typesetting result is generated, and under the condition that the length of the initial typesetting result is determined to reach the preset display processing unit, the target typesetting result is generated based on the initial typesetting result; the method has the advantages that the data analysis logic and the data typesetting logic in the content typesetting process are decoupled, the original serial implementation mode of data analysis and data typesetting is improved to the concurrent implementation mode of analysis-while-typesetting, the waiting time of data analysis is saved, the waiting time of the content typesetting is greatly shortened, the content display speed of the electronic book is improved, and the user experience is further improved.
In some embodiments, S220 comprises: analyzing target chapter data according to a preset typesetting processing unit, and storing each local chapter data obtained through analysis into a cache pool; and obtaining at least one local chapter data from the cache pool to carry out typesetting processing, and generating an initial typesetting result.
The local chapter data are data corresponding to preset typesetting processing units in the target chapter data.
Specifically, according to the embodiment of the disclosure, through the arrangement of the preset typesetting processing units, the typesetting processing units are reduced, and the time consumption of content typesetting is reduced to a certain extent. On the basis, in order to further reduce the time consumption of content typesetting, in the embodiment, the data analysis logic and the data typesetting logic in the content typesetting process can be decoupled by introducing a cache pool, and the original serial implementation mode is improved to a parallel implementation mode.
In the specific implementation, the electronic equipment analyzes the target chapter data step by step according to a preset typesetting processing unit through a data analysis module in the electronic equipment to obtain each local chapter data, and stores the local chapter data in a cache pool after analyzing each time to obtain one local chapter data. Meanwhile, the electronic equipment gradually reads the local chapter data from the cache pool through the data typesetting module therein, and performs typesetting processing on the local chapter data to generate an initial typesetting result.
It should be noted that the execution process between the data parsing module and the data typesetting module is parallel and not interfered with each other.
In some embodiments, the obtaining at least one local chapter data from the cache pool for typesetting processing, and generating the initial typesetting result includes: if the preset data acquisition condition is detected, acquiring at least one local chapter data from a cache pool; and typesetting the acquired local chapter data to generate an initial typesetting result.
The preset data acquisition conditions comprise timer arrival, blank typesetting task and detection of any one of local chapter data which is not typeset in the cache pool.
Specifically, a data typesetting module in the electronic equipment reads local chapter data from the cache pool according to preset data acquisition conditions. For example, the data composition module periodically reads local chapter data from the cache pool upon detecting the arrival of a timer. For another example, the data typesetting module reads the local chapter data from the cache pool under the condition that the data typesetting module detects that the typesetting task is empty, that is, the current typesetting task is completed and the data typesetting module is in an idle state. For another example, the data typesetting module reads local chapter data from the cache pool when detecting that local chapter data which is not typeset exists in the cache pool, that is, when new local chapter data is stored in the cache pool. Also, the number of local chapter data that the data composition module reads from the cache pool at a time may be one or more. For example, the number is set to 2, and the local chapter data is paragraph data, then the data composition module reads 2 paragraph data at a time from the cache pool, and if less than 2, reads 1 paragraph data. And finally, the data typesetting module performs typesetting processing on the read at least one local chapter data to obtain an initial typesetting result.
In some embodiments, the typesetting processing is performed on the acquired local chapter data, and generating the initial typesetting result includes: determining the typesetting word number of one row based on the region size and typesetting style of the typesetting region in the row direction; and sequentially extracting the reading content corresponding to the typesetting word number from the local chapter data each time, and continuously typesetting the reading content in the typesetting area according to the typesetting style to generate an initial typesetting result.
The typesetting style is a display style of the default or user-set reading content in the electronic device, and at least comprises row spacing, word size (i.e. word height and word width) and the like. The typeset word number is the number of reading contents typeset in a line. The row direction is the direction with the included angle smaller than the preset angle threshold value with the horizontal direction.
Specifically, the data typesetting module in the electronic equipment performs typesetting processing in row units, the typesetting content of each row can be text and/or pictures, and the typesetting processing of the pictures is a placeholder for typesetting consistent with the picture size.
In specific implementation, the data typesetting module may calculate the typesetting word number of a row according to the region size and typesetting style of the typesetting region in the row direction. Then, reading contents of the corresponding typesetting word number are read from the partial chapter data. If the reading content is text, the words of the typeset word number can be directly read. If the reading content is a picture, the typesetting word number can be updated according to the size of the picture and the typesetting mode of the picture (such as surrounding characters, fang Paibu of the characters above and below the picture, and the like), and the characters of the updated typesetting word number can be read from the local chapter data. And then, continuously typesetting the read characters, or the picture placeholders and the read characters from the tail end of typeset contents in the typeset area according to the typeset style, and generating an initial typeset result.
It will be appreciated that the initial layout result may be updated once for each row of the layout in accordance with the above procedure.
In some embodiments, after S230, the content typesetting method further includes: if the target typesetting result is determined to contain the reading progress section, displaying the target typesetting result; and if the target typesetting result does not contain the reading progress section, caching the target typesetting result.
The reading progress paragraph is information of the user reading progress recorded in the electronic device, and is recorded as a paragraph, for example, the paragraph content of the x-th paragraph of the x-th page of the x-th chapter. The reading progress section can be recorded by triggering the reading operation of the electronic book after the electronic book is withdrawn in the middle of reading, can be recorded by triggering the reading chapter operation by switching, and can be recorded by triggering the pushing information processing instruction by detecting in the reading process.
Specifically, after the target typesetting result is generated, the electronic device may match the paragraph content included in the target typesetting result with the reading progress paragraph. If the matching is inconsistent, the target typesetting result does not contain the reading progress paragraph, and is cached in a storage space if the target typesetting result is not the page being read by the user. If the matching is consistent, the target typesetting result is the page which is being read by the user, and the target typesetting result is rendered and displayed. And the display processing process and the parsing and typesetting process also belong to a parallel relationship. Therefore, the processing flow of typesetting and displaying can be realized while analyzing, and the display speed of the reading content is further improved, and the reading experience of a user is further improved.
Fig. 3 is a flowchart of another content typesetting method according to an embodiment of the present disclosure.
As shown in fig. 3, the content typesetting method includes:
S310, when the chapter typesetting triggering operation is detected, the data acquisition module acquires target chapter data.
S320, the data analysis module analyzes the target chapter data according to a preset typesetting processing unit, and stores the analyzed local chapter data into a cache pool.
S330, the data typesetting module acquires at least one local chapter data from the cache pool to carry out typesetting processing, and an initial typesetting result is generated.
S340, when the data typesetting module determines that the length of the initial typesetting result reaches the preset display processing unit, generating a target typesetting result based on the initial typesetting result.
And S350, when the page display module determines that the target typesetting result does not contain the reading progress section, storing the target typesetting result into a page data storage space.
S360, when the page display module determines that the target typesetting result in the page data storage space contains the reading progress section, displaying the target typesetting result.
The following is an embodiment of a content typesetting device provided by the embodiment of the present disclosure, where the content typesetting device and the content typesetting method of the foregoing embodiments belong to the same inventive concept, and details that are not described in detail in the embodiment of the content typesetting device may refer to the embodiment of the foregoing content typesetting method.
Fig. 4 shows a schematic structural diagram of a content typesetting device provided in an embodiment of the present disclosure. As shown in fig. 4, the content typesetting apparatus 400 may include:
a target chapter data obtaining unit 410, configured to obtain target chapter data if a chapter composition triggering operation is detected;
The initial typesetting result generating unit 420 is configured to parse and typeset the target chapter data according to a preset typesetting processing unit, and generate an initial typesetting result; the preset typesetting processing unit is an integer multiple of a tag mark unit in the target chapter data, and is smaller than one chapter;
and a target composition result generating unit 430, configured to generate a target composition result based on the initial composition result if it is determined that the length of the initial composition result reaches the preset display processing unit.
According to the content typesetting device provided by the embodiment of the disclosure, under the condition that the chapter typesetting triggering operation is detected, target chapter data can be obtained, the target chapter data are analyzed and typeset according to the preset typesetting processing unit smaller than one chapter, an initial typesetting result is generated, and under the condition that the length of the initial typesetting result is determined to reach the preset display processing unit, the target typesetting result is generated based on the initial typesetting result; the method has the advantages that the data analysis logic and the data typesetting logic in the content typesetting process are decoupled, the original serial implementation mode of data analysis and data typesetting is improved to the concurrent implementation mode of analysis-while-typesetting, the waiting time of data analysis is saved, the waiting time of the content typesetting is greatly shortened, the content display speed of the electronic book is improved, and the user experience is further improved.
In some embodiments, the chapter type setting triggering operation includes at least one of a first start book operation, a restart book operation, a switch read chapter operation, and a push information processing instruction.
In some embodiments, the initial composition result generation unit 420 includes:
The analysis subunit is used for analyzing the target chapter data according to a preset typesetting processing unit and storing the analyzed local chapter data into a cache pool; the local chapter data are data corresponding to preset typesetting processing units in the target chapter data;
and the typesetting sub-unit is used for acquiring at least one local chapter data from the cache pool to carry out typesetting processing and generating an initial typesetting result.
In some embodiments, the typesetting subunit is specifically configured to:
If the preset data acquisition condition is detected, acquiring at least one local chapter data from a cache pool; the method comprises the steps that a preset data acquisition condition comprises the arrival of a timer, the blank of a typesetting task and the detection of any one of local chapter data which are not typeset in a cache pool;
And typesetting the acquired local chapter data to generate an initial typesetting result.
In some embodiments, the preset typesetting processing unit is determined based on the preset adjustment conditions and the value range; the preset adjustment conditions comprise at least one of paragraph number, user reading speed, user waiting threshold and processor performance contained in the target chapter data; the user waiting threshold is used for representing the tolerance degree of waiting time of the user; the value range is a section lower limit value and a section upper limit value which are respectively a label mark unit and a left-closed right-open section of a section.
Further, presetting typesetting processing units as a paragraph; the preset display processing unit is one page adapting to the typesetting area size.
In some embodiments, the target composition result generating unit 430 is specifically configured to:
if the coordinate difference value between the display coordinates of the target row in the initial typesetting result and the tail edge coordinates of the typesetting area in the column direction is smaller than a preset length threshold value, determining that the length of the initial typesetting result reaches a preset display processing unit; the column direction is perpendicular to the row direction corresponding to the target row, and the row direction is the direction with an included angle smaller than a preset angle threshold value with the horizontal direction.
In some embodiments, the content typesetting apparatus 400 further includes a page display unit for:
after the target typesetting result is generated based on the initial typesetting result if the length of the initial typesetting result reaches the preset display processing unit, if the target typesetting result is determined to contain the reading progress section, the target typesetting result is displayed;
and if the target typesetting result does not contain the reading progress section, caching the target typesetting result.
The content typesetting device provided by the embodiment of the disclosure can execute the content typesetting method provided by any embodiment of the disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
It should be noted that, in the embodiment of the content typesetting device, each unit and sub-unit included is only divided according to the functional logic, but not limited to the above-mentioned division, so long as the corresponding functions can be implemented; in addition, the specific names of the functional units/sub-units are also only for convenience of distinguishing from each other, and are not used to limit the protection scope of the present disclosure.
The disclosed embodiments also provide an electronic device that may include a processor and a memory that may be used to store executable instructions. The processor may be configured to read the executable instructions from the memory and execute the executable instructions to implement the content typesetting method in the foregoing embodiment.
Fig. 5 shows a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
As shown in fig. 5, the electronic device 500 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 501, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the information processing apparatus 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input/output interface (I/O interface) 505 is also connected to the bus 504.
In general, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 507 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 508 including, for example, magnetic tape, hard disk, etc.; and communication means 509. The communication means 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data.
It should be noted that the electronic device 500 shown in fig. 5 is only an example, and should not impose any limitation on the functions and the application scope of the embodiments of the present disclosure. That is, while FIG. 5 illustrates an electronic device 500 having various means, it should be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 509, or from the storage means 508, or from the ROM 502. When the computer program is executed by the processing apparatus 501, the above-described functions defined in the content typesetting method of any embodiment of the present disclosure are performed.
The embodiments of the present disclosure also provide a computer-readable storage medium storing a computer program, which when executed by a processor, causes the processor to implement the content typesetting method in any of the embodiments of the present disclosure.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP, and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer-readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the steps of the content typesetting method described in any of the embodiments of the present disclosure.
In an embodiment of the present disclosure, computer program code for performing the operations of the present disclosure may be written in one or more programming languages, including but not limited to an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of devices, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), etc.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.

Claims (11)

1. A content typesetting method, comprising:
If the chapter typesetting triggering operation is detected, acquiring target chapter data of a target chapter corresponding to the chapter typesetting triggering operation;
Analyzing and typesetting the target chapter data in batches according to a preset typesetting processing unit to generate an initial typesetting result; the preset typesetting processing unit is an integer multiple of a tag mark unit in the target chapter data, and is smaller than one chapter;
And if the length of the initial typesetting result is determined to reach a preset display processing unit, generating a target typesetting result based on the initial typesetting result.
2. The method of claim 1, wherein the chapter type setting triggering operation includes at least one of a first start book operation, a restart book operation, a switch read chapter operation, and a push information processing instruction.
3. The method according to claim 1, wherein the parsing and typesetting the target chapter data according to a preset typesetting processing unit, and generating an initial typesetting result includes:
Analyzing the target chapter data according to the preset typesetting processing unit, and storing each local chapter data obtained by analysis into a cache pool; the local chapter data are data corresponding to the preset typesetting processing units in the target chapter data;
And obtaining at least one piece of local chapter data from the cache pool to carry out typesetting processing, and generating the initial typesetting result.
4. A method according to claim 3, wherein the obtaining at least one local chapter data from the cache pool for typesetting processing, and generating the initial typesetting result includes:
If a preset data acquisition condition is detected, acquiring at least one piece of local chapter data from the cache pool; the preset data acquisition conditions comprise timer arrival, empty typesetting task and detection of any one of the local chapter data which are not typeset in the cache pool;
And typesetting the acquired local chapter data to generate the initial typesetting result.
5. The method according to claim 1, wherein the preset typesetting processing unit is determined based on a preset adjustment condition and a value range; the preset adjustment conditions comprise at least one of paragraph number, user reading speed, user waiting threshold and processor performance contained in target chapter data; the user waiting threshold is used for representing the tolerance degree of waiting time of the user; the value range is a section lower limit value and a section upper limit value, and the label mark unit and the left-closing and right-opening section of the chapter are respectively.
6. The method according to claim 5, wherein the preset typesetting processing unit is a paragraph; the preset display processing unit is a page adapting to the size of the typesetting area.
7. The method according to claim 6, wherein determining that the length of the initial layout result reaches a preset display processing unit includes:
If the coordinate difference value between the display coordinates of the target row in the initial typesetting result and the tail edge coordinates of the typesetting area in the column direction is smaller than a preset length threshold value, determining that the length of the initial typesetting result reaches the preset display processing unit; the column direction is perpendicular to the row direction corresponding to the target row, and the row direction is a direction with an included angle smaller than a preset angle threshold value with the horizontal direction.
8. The method according to claim 1, wherein after the target layout result is generated based on the initial layout result if it is determined that the length of the initial layout result reaches a preset display processing unit, the method further comprises:
If the target typesetting result is determined to contain the reading progress paragraph, displaying the target typesetting result;
And if the target typesetting result does not contain the reading progress paragraph, caching the target typesetting result.
9. A content typesetting apparatus, comprising:
the system comprises a target chapter data acquisition unit, a chapter typesetting trigger operation acquisition unit and a chapter editing unit, wherein the target chapter data acquisition unit is used for acquiring target chapter data of a target chapter corresponding to the chapter typesetting trigger operation if the chapter typesetting trigger operation is detected;
The initial typesetting result generation unit is used for analyzing and typesetting the target chapter data in batches according to a preset typesetting processing unit to generate an initial typesetting result; the preset typesetting processing unit is an integer multiple of a tag mark unit in the target chapter data, and is smaller than one chapter;
And the target typesetting result generating unit is used for generating a target typesetting result based on the initial typesetting result if the length of the initial typesetting result reaches a preset display processing unit.
10. An electronic device, comprising:
a processor;
a memory for storing executable instructions;
Wherein the processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the content typesetting method of any one of the preceding claims 1-8.
11. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, causes the processor to implement the content typesetting method of any one of the preceding claims 1-8.
CN202210522143.3A 2022-05-13 2022-05-13 Content typesetting method, device, equipment and storage medium Active CN115146608B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210522143.3A CN115146608B (en) 2022-05-13 2022-05-13 Content typesetting method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210522143.3A CN115146608B (en) 2022-05-13 2022-05-13 Content typesetting method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115146608A CN115146608A (en) 2022-10-04
CN115146608B true CN115146608B (en) 2024-07-23

Family

ID=83406374

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210522143.3A Active CN115146608B (en) 2022-05-13 2022-05-13 Content typesetting method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115146608B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103593333A (en) * 2013-10-16 2014-02-19 小米科技有限责任公司 Electronic book document processing method, terminal and electronic equipment
CN114330277A (en) * 2021-12-31 2022-04-12 北京字节跳动网络技术有限公司 Reading typesetting method, device, equipment and storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779118B (en) * 2012-07-17 2015-07-15 周广超 Paper typesetting method and system
CN108090037B (en) * 2016-11-21 2020-10-13 北大方正集团有限公司 Automatic typesetting method and device
CN111382258A (en) * 2018-12-27 2020-07-07 阿里巴巴集团控股有限公司 Method and device for determining electronic reading object chapter
CN110263316A (en) * 2019-06-27 2019-09-20 深圳前海微众银行股份有限公司 A kind of document handling method, device and computer equipment
US10769348B1 (en) * 2019-09-23 2020-09-08 Typetura Llc Dynamic typesetting
CN113204951A (en) * 2021-05-27 2021-08-03 广州文石信息科技有限公司 Document processing method, document processing device, storage medium and computer equipment
CN113515928B (en) * 2021-07-13 2023-03-28 抖音视界有限公司 Electronic text generation method, device, equipment and medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103593333A (en) * 2013-10-16 2014-02-19 小米科技有限责任公司 Electronic book document processing method, terminal and electronic equipment
CN114330277A (en) * 2021-12-31 2022-04-12 北京字节跳动网络技术有限公司 Reading typesetting method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN115146608A (en) 2022-10-04

Similar Documents

Publication Publication Date Title
EP3955153A1 (en) Method and apparatus for inserting information into online document
NL2008222A (en) Selective rendering of off-screen content.
US9671926B2 (en) Method and terminal device for displaying dynamic icon
CN113238706B (en) View display method, device, equipment and medium
CN110070593B (en) Method, device, equipment and medium for displaying picture preview information
WO2023284588A1 (en) Electronic text generation method and apparatus, device, and medium
CN113395572A (en) Video processing method and device, storage medium and electronic equipment
WO2023124936A1 (en) Reading typesetting method and apparatus, device, and storage medium
CN112287206A (en) Information processing method and device and electronic equipment
CN111240793B (en) Method, device, electronic equipment and computer readable medium for cell prerendering
CN114416261B (en) Information display method, device, equipment and medium
US20120089899A1 (en) Method and system for redisplaying a web page
CN115731313A (en) SVG format picture processing method, device, equipment, medium and product
US20230367963A1 (en) Character display method and apparatus, electronic device, and computer-readable storage medium
CN114445754A (en) Video processing method and device, readable medium and electronic equipment
CN115146608B (en) Content typesetting method, device, equipment and storage medium
CN114327732B (en) Page configuration method, page configuration device, electronic equipment and computer readable medium
CN115328362A (en) Book information display method, device, equipment and storage medium
CN115544368A (en) Recommendation method and device for media content
CN115344718A (en) Cross-region document content identification method, device, equipment, medium and program product
CN114817809A (en) Information display method, device, equipment and storage medium
CN114925285A (en) Book information processing method, device, equipment and storage medium
CN112445478A (en) Graphic file processing method, device, equipment and medium
CN114968463B (en) Entity display method, device, equipment and medium
CN111797591B (en) Layout recovery method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: Tiktok vision (Beijing) Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

GR01 Patent grant