CN111881656B - Text drawing method and device in card game - Google Patents

Text drawing method and device in card game Download PDF

Info

Publication number
CN111881656B
CN111881656B CN202010803086.7A CN202010803086A CN111881656B CN 111881656 B CN111881656 B CN 111881656B CN 202010803086 A CN202010803086 A CN 202010803086A CN 111881656 B CN111881656 B CN 111881656B
Authority
CN
China
Prior art keywords
typesetting
character
text
characters
grouping
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
CN202010803086.7A
Other languages
Chinese (zh)
Other versions
CN111881656A (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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202010803086.7A priority Critical patent/CN111881656B/en
Publication of CN111881656A publication Critical patent/CN111881656A/en
Application granted granted Critical
Publication of CN111881656B publication Critical patent/CN111881656B/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/166Editing, e.g. inserting or deleting
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/60Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (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)
  • Processing Or Creating Images (AREA)

Abstract

The application provides a text drawing method and a text drawing device in a card game, which are characterized in that firstly, a target text of a card to be drawn is obtained, and the target text is converted into at least one character stream according to escape characters in the target text; then, according to the character grouping rule, grouping the characters in the character stream; secondly, typesetting the character stream according to the grouping result of the grouping process and the parameter information of the text drawing area in the card to be drawn; in the typesetting result of the typesetting processing, the characters belonging to the same group are positioned in the same row; and finally, drawing the character stream in the text drawing area according to the typesetting result. According to the method and the device, the characters in the character stream corresponding to the text are grouped, typesetting processing is conducted on the character stream according to the grouping result and the parameter information of the text drawing area, typesetting and drawing automation of the text can be achieved, and drawing efficiency of the card text is improved.

Description

Text drawing method and device in card game
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for drawing text in a card game.
Background
With the rapid development of science and technology and economy, the mental demands of people are gradually increased, and games become popular choices for people to play. In a game, there is a large amount of text that plays an explanatory role for the game, and the text is usually drawn in text boxes in the game, playing a vital role for the game. Among many types of games, the amount of text in card games is particularly large. In card games, there are hundreds or thousands of cards, each of which has corresponding interpretation text drawn therein.
At present, texts on cards are typeset usually in a manual mode, and then are drawn according to typesetting results, and as the content and the height of the texts of each card are different, the number of cards is very large, so that very much human resources are consumed, and the efficiency is very low.
Disclosure of Invention
In view of this, the present application aims to provide a method and an apparatus for text drawing in a card game, which can realize automation of typesetting and drawing of text and improve efficiency of text drawing.
The embodiment of the application provides a text drawing method in a card game, which comprises the following steps:
Acquiring a target text of a card to be drawn, and converting the target text into at least one character stream according to escape characters in the target text;
grouping the characters in the character stream according to a character grouping rule, wherein the grouping rule is used for determining characters needing to be continuously displayed in the character stream;
typesetting the character stream according to the grouping result of the grouping process and the parameter information of the text drawing area in the card to be drawn so as to obtain an typesetting result of the typesetting process;
and drawing the character stream in the text drawing area according to the typesetting result.
In one possible implementation, the character grouping rules include a text grouping rule and a symbol grouping rule;
the grouping processing of the characters in the character stream according to the character grouping rule comprises the following steps:
grouping the literal characters in the character stream according to the literal grouping rule to obtain at least one literal character group;
and dividing the symbol characters in the character stream into the corresponding character groups according to the symbol grouping rule to obtain the grouping result.
In a possible implementation manner, the typesetting processing of the character stream according to the grouping result of the grouping processing and the parameter information of the text drawing area in the card to be drawn includes:
typesetting the character stream in the text drawing area according to preset typesetting parameters, the grouping result and parameter information of the text drawing area;
and adjusting the typesetting parameters according to typesetting results of the typesetting treatment, and repeating typesetting treatment and the step of adjusting the typesetting parameters until preset cut-off conditions are met.
In one possible implementation, the typesetting parameters include at least one of the following: font, width and height of characters, scaling value of characters, line spacing, segment spacing, initial line number.
In one possible implementation manner, the typesetting processing of the character stream in the text drawing area according to the preset typesetting parameters, the grouping result and the parameter information of the text drawing area includes:
adjusting the initial line number according to the number of the character streams;
determining a typesetting starting position in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of characters in the typesetting parameters, the scaling value of the characters, the line spacing and the segment spacing;
From the typesetting starting position, adding characters in the character stream into the text drawing area one by one according to the preset typesetting parameters; line feed occurs when the remaining positions in a line are insufficient to accommodate all characters in the next group; and when all the characters in one character stream are added, the segments are replaced when the next character stream exists.
In one possible embodiment, the preset cutoff condition includes at least one of the following: the zoom value of the character is smaller than or equal to a first preset threshold value, and the actual line number is smaller than or equal to the initial line number and no character located outside the text drawing area exists; wherein,
and according to the typesetting result of the typesetting processing, adjusting the typesetting parameters, and repeating the steps of typesetting processing and adjusting the typesetting parameters until a preset cut-off condition is met, wherein the typesetting method comprises at least one of the following steps:
if the actual line number is greater than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area;
if the typesetting result includes characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area.
In one possible implementation manner, the step of adjusting the typesetting parameters according to the typesetting result of the typesetting process and repeating the typesetting process and the step of adjusting the typesetting parameters until a preset cutoff condition is met further includes:
if the characters outside the text drawing area do not exist and the actual line number is smaller than or equal to the initial line number, marking the current typesetting result;
if the scaling value of the character is larger than a second preset threshold value, reducing the scaling value of the character by a preset step length on the premise of ensuring that the scaling value of the character is larger than the second preset threshold value, taking the actual line number as the initial line number, re-determining the typesetting starting position, and returning to the step of adding the character into the text drawing area.
In a possible implementation manner, the drawing the character stream in the text drawing area according to the typesetting result includes:
and drawing the character stream in the text drawing area according to the typesetting result of the latest mark.
The embodiment of the application also provides a text drawing device in the card game, which comprises:
The conversion module is used for acquiring a target text of a card to be drawn and converting the target text into at least one character stream according to escape characters in the target text;
the grouping module is used for grouping the characters in the character stream according to a character grouping rule, wherein the grouping rule is used for determining characters which need to be continuously displayed in the character stream;
the typesetting module is used for typesetting the character stream according to the grouping result of the grouping process and the parameter information of the text drawing area in the card to be drawn so as to obtain the typesetting result of the typesetting process;
and the drawing module is used for drawing the character stream in the text drawing area according to the typesetting result.
In one possible implementation, the character grouping rules include a text grouping rule and a symbol grouping rule;
the grouping module is specifically configured to:
grouping the literal characters in the character stream according to the literal grouping rule to obtain at least one literal character group;
and dividing the symbol characters in the character stream into the corresponding character groups according to the symbol grouping rule to obtain the grouping result.
In one possible implementation, the typesetting module includes:
the typesetting unit is used for typesetting the character stream in the text drawing area according to preset typesetting parameters, the grouping result and the parameter information of the text drawing area;
and the circulating typesetting unit is used for adjusting the typesetting parameters according to typesetting results of the typesetting processing, and repeating the typesetting processing and the step of adjusting the typesetting parameters until the preset cut-off condition is met.
In one possible implementation, the typesetting parameters include at least one of the following: font, width and height of characters, scaling value of characters, line spacing, segment spacing, initial line number.
In a possible implementation manner, the pre-typesetting unit is specifically configured to:
adjusting the initial line number according to the number of the character streams;
determining a typesetting starting position in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of characters in the typesetting parameters, the scaling value of the characters, the line spacing and the segment spacing;
from the typesetting starting position, adding characters in the character stream into the text drawing area one by one according to the preset typesetting parameters;
Line feed occurs when the remaining positions in a line are insufficient to accommodate all characters in the next group; and when all the characters in one character stream are added, the segments are replaced when the next character stream exists.
In one possible embodiment, the preset cutoff condition includes at least one of the following: the zoom value of the character is smaller than or equal to a first preset threshold value, and the actual line number is smaller than or equal to the initial line number and no character located outside the text drawing area exists; wherein,
the cyclic typesetting unit is specifically used for:
if the actual line number is greater than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area;
if the typesetting result includes characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area.
In a possible implementation manner, the circulating typesetting unit is further used for:
if the characters outside the text drawing area do not exist and the actual line number is smaller than or equal to the initial line number, marking the current typesetting result;
If the scaling value of the character is larger than a second preset threshold value, reducing the scaling value of the character by a preset step length on the premise of ensuring that the scaling value of the character is larger than the second preset threshold value, taking the actual line number as the initial line number, re-determining the typesetting starting position, and returning to the step of adding the character into the text drawing area.
In one possible implementation manner, the drawing module is specifically configured to:
and drawing the character stream in the text drawing area according to the typesetting result of the latest mark.
The embodiment of the application also provides electronic equipment, which comprises: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication over the bus when the electronic device is running, the machine-readable instructions when executed by the processor performing the steps of:
acquiring a target text of a card to be drawn, and converting the target text into at least one character stream according to escape characters in the target text;
grouping the characters in the character stream according to a character grouping rule, wherein the grouping rule is used for determining characters needing to be continuously displayed in the character stream;
Typesetting the character stream according to the grouping result of the grouping process and the parameter information of the text drawing area in the card to be drawn so as to obtain an typesetting result of the typesetting process;
and drawing the character stream in the text drawing area according to the typesetting result.
In one possible implementation, the character grouping rules include a text grouping rule and a symbol grouping rule;
in one possible implementation manner, the processor, when executing the grouping processing on the characters in the character stream according to the character grouping rule, specifically executes:
grouping the literal characters in the character stream according to the literal grouping rule to obtain at least one literal character group;
and dividing the symbol characters in the character stream into the corresponding character groups according to the symbol grouping rule to obtain the grouping result.
In a possible implementation manner, when the processor performs the grouping result according to the grouping process and the parameter information of the text drawing area in the card to be drawn, the processor specifically performs the typesetting process on the character stream:
Typesetting the character stream in the text drawing area according to preset typesetting parameters, the grouping result and parameter information of the text drawing area;
and adjusting the typesetting parameters according to typesetting results of the typesetting treatment, and repeating typesetting treatment and the step of adjusting the typesetting parameters until preset cut-off conditions are met.
In one possible implementation, the typesetting parameters include at least one of the following: font, width and height of characters, scaling value of characters, line spacing, segment spacing, initial line number.
In one possible implementation manner, the processor specifically performs, when performing the typesetting processing on the character stream in the text drawing area according to the preset typesetting parameters, the grouping result, and the parameter information of the text drawing area:
adjusting the initial line number according to the number of the character streams;
determining a typesetting starting position in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of characters in the typesetting parameters, the scaling value of the characters, the line spacing and the segment spacing;
From the typesetting starting position, adding characters in the character stream into the text drawing area one by one according to the preset typesetting parameters;
line feed occurs when the remaining positions in a line are insufficient to accommodate all characters in the next group; and when all the characters in one character stream are added, the segments are replaced when the next character stream exists.
In one possible embodiment, the preset cutoff condition includes at least one of the following: the zoom value of the character is smaller than or equal to a first preset threshold value, and the actual line number is smaller than or equal to the initial line number and no character located outside the text drawing area exists; wherein,
the processor adjusts the typesetting parameters according to typesetting results of the typesetting processing, and repeatedly performs typesetting processing and the step of adjusting the typesetting parameters until a preset cut-off condition is met, and specifically performs:
if the actual line number is greater than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area;
if the typesetting result includes characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area.
In one possible implementation manner, the processor adjusts the typesetting parameters according to the typesetting result of the typesetting process, and repeats the steps of typesetting process and adjusting the typesetting parameters until a preset cut-off condition is met, and further performs:
if the characters outside the text drawing area do not exist and the actual line number is smaller than or equal to the initial line number, marking the current typesetting result;
if the scaling value of the character is larger than a second preset threshold value, reducing the scaling value of the character by a preset step length on the premise of ensuring that the scaling value of the character is larger than the second preset threshold value, taking the actual line number as the initial line number, re-determining the typesetting starting position, and returning to the step of adding the character into the text drawing area.
In a possible implementation manner, the processor, when executing drawing the character stream in the text drawing area according to the typesetting result, specifically executes:
and drawing the character stream in the text drawing area according to the typesetting result of the latest mark.
Embodiments of the present application also provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of a text drawing method in a card game as described above.
According to the text drawing method and device in the card game, firstly, the target text of a card to be drawn is obtained, and the target text is converted into at least one character stream according to escape characters in the target text; then, according to the character grouping rule, grouping the characters in the character stream; secondly, typesetting the character stream according to the grouping result of the grouping process and the parameter information of the text drawing area in the card to be drawn; obtaining typesetting results of the typesetting treatment; and finally, drawing the character stream in the text drawing area according to the typesetting result. According to the method and the device, the characters in the character stream corresponding to the text are grouped, typesetting processing is conducted on the character stream according to the grouping result and the parameter information of the text drawing area, typesetting and drawing automation of the text can be achieved, and drawing efficiency of the card text is improved.
In order to make the above objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting the scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 shows a flow chart of a text drawing method in a card game provided in an embodiment of the present application;
FIG. 2 illustrates a flow chart of another method of text rendering in a card game provided in an embodiment of the present application;
FIG. 3 is a schematic diagram of a text drawing area in a text drawing method in a card game according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating repeated typesetting processing in a text drawing method in a card game according to an embodiment of the present application;
FIG. 5a shows a schematic diagram of a card with a text drawing area rectangular;
FIG. 5b is a schematic diagram of the card after the text rendering area removes the offensiveness and vital value display area;
FIG. 6 is a schematic diagram of a text drawing device in a card game according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a text drawing device in another card game according to an embodiment of the present application;
fig. 8 shows a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. Based on the embodiments of the present application, every other embodiment that a person skilled in the art would obtain without making any inventive effort is within the scope of protection of the present application.
First, application scenarios applicable to the present application will be described. The method and the device can be applied to text drawing of the virtual cards in card games. In the embodiment of the application, the case of text drawing of a virtual card in a card game is described, but the case is only one embodiment, and the application can be applied to other scenes without performing creative labor, and all the situations are within the protection scope of the application.
According to research, in a card game, a large number of cards exist, different texts are drawn on different cards, the content and the height of the texts are different, the region which can be drawn in the cards are also different, if the texts are drawn into the cards according to the traditional typesetting standard which is carried out character by character, some consecutive characters can be typeset into different rows, the readability of the drawn texts is poor, so that typesetting is carried out in a manual processing mode, and because the number of cards in the card game is extremely large, a large amount of human resources are consumed in the manual typesetting and drawing modes, errors are easy to occur, and the efficiency is extremely low.
Based on the text, the embodiment of the application provides a text drawing method in a card game, so that automation of text typesetting and drawing is realized, and efficiency of card text typesetting and drawing is improved.
Referring to fig. 1, fig. 1 is a flowchart of a text drawing method in a card game according to an embodiment of the present application. As shown in fig. 1, the text drawing method in the card game provided in the embodiment of the present application includes:
s101, acquiring a target text of a card to be drawn, and converting the target text into at least one character stream according to escape characters in the target text.
The target text can be a text to be drawn on the card to be drawn, and can be composed of explanatory characters and escape characters, wherein the explanatory characters are texts for explaining the attribute and effect of the card, and can generally comprise characters, figures, symbols and the like; the escape character may be text defining the target text format and the inserted content. The escape character may be some pre-agreed text processing rule, identified beginning with #.
By way of example, the target text may be in the form of:
let one #cffff0000 get 5#p (img_hujia) #r response: when the terracotta soldiers are attacked, the card is automatically used for themselves.
Where #cffff000 represents that the subsequent text needs to be displayed in red, #1 represents that the red display is cut off, #p (img_hujia) represents that the picture under the img_hujia path is displayed, and #r represents manual line feed.
In the step, the escape character in the target text can be scanned, after the escape character is scanned, the character in the target text is processed according to a preset escape rule, if the character in the scanned text is not the escape character, the character is used as an independent character, and if the escape character for manual line changing exists in the target text, the character after the manual line changing of the escape character is split into a front character stream and a rear character stream.
For example, the above example of the target text may be converted into the following two character streams:
character stream 1: make one own side Shende 5
Character stream 2: and (3) responding: when the terracotta soldiers are attacked, the card is automatically used for themselves.
Wherein the color of the "in-the-way god" character is red, and the "# represents the picture under the img_hujia path.
S102, carrying out grouping processing on characters in the character stream according to a character grouping rule, wherein the grouping rule is used for determining characters needing to be continuously displayed in the character stream.
In the step, the character grouping rule is used for grouping characters needing to be displayed in the same row in the character stream into the same group, so that in the subsequent typesetting step, the characters needing to be displayed in the same row are typeset into the same row, and the readability of the drawn card text is further improved.
In one possible implementation, the character grouping rules may include a text grouping rule and a symbol grouping rule;
the grouping processing of the characters in the character stream according to the character grouping rule comprises the following steps:
grouping the literal characters in the character stream according to the literal grouping rule to obtain at least one literal character group;
and dividing the symbol characters in the character stream into the corresponding character groups according to the symbol grouping rule to obtain the grouping result.
The word grouping rule is used for grouping words in the character stream, for example, chinese words in the character stream can be individually grouped into a group, and foreign language words in the character stream can be grouped into a group; the symbol grouping rules are used to group symbols in a character stream, e.g., grouping a dangling character with a preceding character of the dangling character and grouping an ending-not character with a following character of the ending-not character.
Specifically, the hanging characters refer to characters that can be hung at the end of a sentence, such as ",". ", and", ","; ","; ",": ", and", "" ", a" > "," ";" - ",") "," "," ] ", and the like; the characters incapable of ending refer to characters incapable of being placed at the end of a sentence, such as "[", "" [ "," "", "", etc.
S103, typesetting the character stream according to the grouping result of the grouping process and the parameter information of the text drawing area in the card to be drawn so as to obtain the typesetting result of the typesetting process.
In the step, typesetting processing can be performed on the character stream according to the parameter information of the text drawing area, characters in the character stream are added into the text drawing area, and characters belonging to the same group are arranged in the same row, so that the readability of the typeset text is ensured, and further, the typesetting result of the typesetting processing is obtained.
The parameter information of the text drawing area may include information such as a position of the text drawing area and a size of the text drawing area.
In a possible implementation manner, the typesetting processing of the character stream according to the grouping result of the grouping processing and the parameter information of the text drawing area in the card to be drawn includes:
typesetting the character stream in the text drawing area according to preset typesetting parameters, the grouping result and parameter information of the text drawing area;
and adjusting the typesetting parameters according to typesetting results of the typesetting treatment, and repeating typesetting treatment and the step of adjusting the typesetting parameters until preset cut-off conditions are met.
In this step, typesetting processing can be performed on the character stream according to preset typesetting parameters, and since the typesetting parameters are preset and cannot meet the requirements of various cards and corresponding target texts thereof, poor readability of the obtained typesetting result easily results in conditions of inconsistent typesetting effect, characters exceeding text drawing areas and the like, the adjustment of the typesetting parameters is required according to the typesetting result of the first time, and typesetting processing is performed here. After typesetting is performed again, the effect of the obtained typesetting result may still be poor, multiple typesetting parameters may be adjusted, and typesetting may be performed according to the adjusted typesetting parameters until the typesetting result meets the preset cut-off condition.
In one possible implementation, the typesetting parameters include at least one of the following: font, width and height of characters, scaling value of characters, line spacing, segment spacing, initial line number.
Wherein, the zoom value of the character refers to the zoom ratio of the character during typesetting; the line spacing refers to the spacing between each line when a character stream has multiple lines in the typesetting process; the segment spacing refers to the spacing between two different character streams in the typesetting process; the initial number of rows may be set to 1.
In one possible implementation manner, the typesetting processing of the character stream in the text drawing area according to the preset typesetting parameters, the grouping result and the parameter information of the text drawing area includes:
adjusting the initial line number according to the number of the character streams;
determining a typesetting starting position in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of characters in the typesetting parameters, the scaling value of the characters, the line spacing and the segment spacing;
from the typesetting starting position, adding characters in the character stream into the text drawing area one by one according to the preset typesetting parameters;
line feed occurs when the remaining positions in a line are insufficient to accommodate all characters in the next group; and when all the characters in one character stream are added, the segments are replaced when the next character stream exists.
In this step, the number of character streams after the target text conversion may be determined first, and the value of the initial line number may be set as the number of character streams. For example, in the example of the character stream described above, two character streams are included in total, and then the initial line number may be adjusted to 2.
After the initial line number is adjusted, a typesetting starting position in the text drawing area can be determined according to the initial line number, the parameter information of the text drawing area, the height of characters in the typesetting parameters, the scaling value of the characters, the line spacing and the segment spacing.
Specifically, for the attractive appearance and the readability of the card, the target text can be drawn in the middle position of the text drawing area as much as possible, and for achieving the above effects, the number of lines of the target text in the text drawing area can be estimated first, then the typesetting starting position is determined according to the estimated number of lines, and the initial number of lines is the estimated number of lines of the target text in the text drawing area.
After the initial line number is adjusted, a vertical typesetting starting position can be determined according to the height of the characters, the zoom value of the characters, the line spacing, the segment spacing and the height of the text drawing area, and then a horizontal typesetting starting position can be determined according to the width of the text drawing area at the vertical typesetting starting position.
After determining the typesetting starting position, the characters can be added into the text drawing area one by one from the typesetting starting position according to the sequence in the target text, if all the characters in the group to which the last character belongs in one row are not in the same row in the typesetting process, all the characters in the group are put into the next row, and when all the characters in one character stream are typeset, and other residual character streams exist, segment replacement is performed, and typesetting is continued from the new paragraph.
It should be noted that the shape of the text drawing area may be irregular, for example, in a french card, the shape of the text drawing area may be rectangular, but in a character card or slave card, the text drawing area is changed into an irregular shape by removing the offensive display area and the life value display area on the basis of the french card, so that the lateral start position of each line needs to be set according to the width of the text drawing area of the line every time it is changed.
In one possible embodiment, the preset cutoff condition includes at least one of the following: the zoom value of the character is smaller than or equal to a first preset threshold value, and the actual line number is smaller than or equal to the initial line number and no character located outside the text drawing area exists; wherein,
and according to the typesetting result of the typesetting processing, adjusting the typesetting parameters, and repeating the steps of typesetting processing and adjusting the typesetting parameters until a preset cut-off condition is met, wherein the typesetting method comprises at least one of the following steps:
if the actual line number is greater than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area; and
If the typesetting result includes characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area.
The actual line number is the line number actually occupied by the target text after typesetting, if the actual line number is greater than the initial line number, the text after typesetting is not in the middle part of the text drawing area on the whole, and the typesetting starting position needs to be determined again and typesetting is performed again. The first preset threshold may be set to 0.
If the characters outside the text drawing area exist, the text quantity of the target text can be stated to be large, and the text drawing area can not accommodate all the target text, the scaling value of the characters can be reduced, the volume of the text is reduced, and then the text is completely inside the text drawing area.
In one possible implementation manner, the step of adjusting the typesetting parameters according to the typesetting result of the typesetting process and repeating the typesetting process and the step of adjusting the typesetting parameters until a preset cutoff condition is met further includes:
If the characters outside the text drawing area do not exist and the actual line number is smaller than or equal to the initial line number, marking the current typesetting result;
if the scaling value of the character is larger than a second preset threshold value, reducing the scaling value of the character by a preset step length on the premise of ensuring that the scaling value of the character is larger than the second preset threshold value, taking the actual line number as the initial line number, re-determining the typesetting starting position, and returning to the step of adding the character into the text drawing area.
In this step, if there is no character located outside the text drawing area and the actual number of lines is less than or equal to the initial number of lines, it may be determined that the typesetting result meets the drawing standard, and the typesetting result is marked.
But in order to further optimize the appreciation and readability of the text, the scaling value of the characters may be adjusted again in order to reduce the number of lines of the text as a whole. And under the condition that the zoom value of the character is larger than a second preset threshold value, typesetting is conducted again after the zoom value of the character is reduced, if the actual number of lines at the moment is smaller than or equal to the initial number of lines, the current typesetting result can be determined to be better than the typesetting result of the previous mark, and the typesetting result of the previous mark is replaced by the current typesetting result, so that the typesetting result of the mark is updated.
When the circulation is finished, the marked typesetting result can be regarded as the optimal typesetting result.
And S104, drawing the character stream in the text drawing area according to the typesetting result.
In a possible implementation manner, the drawing the character stream in the text drawing area according to the typesetting result includes:
and drawing the character stream in the text drawing area according to the typesetting result of the latest mark.
In this step, after the end of the cyclic layout, text drawing can be performed using the layout result of the latest mark, so that the drawing effect can be optimized.
According to the text drawing method in the card game, firstly, a target text of a card to be drawn is obtained, and the target text is converted into at least one character stream according to escape characters in the target text; then, according to the character grouping rule, grouping the characters in the character stream; secondly, typesetting the character stream according to the grouping result of the grouping process and the parameter information of the text drawing area in the card to be drawn; in the typesetting result of the typesetting processing, the characters belonging to the same group are positioned in the same row; and finally, drawing the character stream in the text drawing area according to the typesetting result. According to the method and the device, the characters in the character stream corresponding to the text are grouped, typesetting processing is conducted on the character stream according to the grouping result and the parameter information of the text drawing area, typesetting and drawing automation of the text can be achieved, and drawing efficiency of the card text is improved.
Referring to fig. 2, fig. 2 is a flowchart of a text drawing method in a card game according to another embodiment of the present application. As shown in fig. 2, the text drawing method in the card game provided in the embodiment of the present application includes:
s201, analyzing the text.
This step is the same principle as step S101. The parsing text is a step of parsing the target text of the card to be drawn, and the target text can be split into at least one character stream according to the escape characters in the target text.
S202, calculating peer information.
This step is the same principle as step S102. The method comprises the steps of calculating the same-line information, namely grouping characters in a character stream by using a same-line regular expression and other special rules, wherein the characters in the same group can store the mapping relation between the positions of the characters and the first character position of the same group, and further realize that the characters and the characters in the same group are added into the same line during typesetting.
S203, self-adaptive size processing.
This step is the same principle as step S103. The self-adaptive size processing finds out proper typesetting starting position and proper scaling value of characters in the text drawing area, and records typesetting effect, wherein the typesetting effect can comprise row information such as row height, row width, contained characters and the like, and character information such as state, size and the like of the characters.
Referring to fig. 3, fig. 3 is a schematic diagram of a text drawing area in a text drawing method in a card game according to an embodiment of the present application. As shown in FIG. 3, the text drawing area may be an irregular rectangle, a plane rectangular coordinate system is arranged on the text drawing area, the x-axis of the plane rectangular coordinate system coincides with the bottom edge of the text drawing area, the y-axis coincides with one side edge of the text drawing area, the height of the text drawing area is H, the width is W, a notch of a rectangle is respectively arranged at the lower left corner and the lower right corner of the text drawing area and used for displaying the attack force and the life value of the card, and the height of the rectangular notch is H Width W
For example, the paragraph number may be set to be Pn, the width of a common text character is Gw, the height is Gh, the current line number is Ln, and the current character scaling value is S; the following steps may be specifically used in step S203:
step 1, attempting to typeset for the first time with a designated font and S (initially 1); let Ln be the value of Pn, the Y-axis offset mo= (Pn-1) due to the paragraph is the segment interval/2.
And 2, setting the Y coordinate (Lp) of the initial position as min (H, H/2+Mo+Ln, gh/2).
Step 3, starting from the typesetting starting position, typesetting under the current scaling value S, adding characters into a text drawing area one by one, and continuing if the current line width can accommodate the characters; if the character is a suspension character and the last character is not the suspension character, adding the character and continuing; if the character is the same-line character, the line is put in first; for the line width exceeding, line feed processing is required, if the same line and suspension characters or two continuous suspension characters are forced, the end characters and the previous characters of the super line are required to be moved out of the line, otherwise, only the end characters of the super line are required to be moved out of the line; for the removed character, the preceding peer character or the non-ending character also needs to be removed and placed on the next row.
Wherein for a line feed, the Y coordinate (Lp) of the new line needs to be subtracted from the Y coordinate of the previous line by the line spacing and Gh; for a segment change, the Y-coordinate (Lp) of the new segment needs to be subtracted from the Y-coordinate of the previous row by the segment spacing and Gh; the line width of each line is determined by determining whether Lp is equal to [0, H ] ]And (5) determining the intersection.
And step 4, performing repeated typesetting through typesetting results of typesetting treatment until preset conditions are met.
Referring to fig. 4, fig. 4 is a flowchart illustrating repeated typesetting processing (step 4) in a text drawing method in a card game according to an embodiment of the present application.
As shown in fig. 4, in step 4, if the actual number of lines is greater than the current number of lines, ln+1 is continued to step 2, that is, the Y coordinate (Lp) of the typesetting starting position is min (H, H/2+mo+ln×gh/2); if Lp <0 (text exceeds the lower limit of the limited area), subtracting the zoom step value from S, if S is less than or equal to 0, typesetting s=1 (no proper typesetting result, i.e. no target, no marking of typesetting result is performed), otherwise continuing step 1, i.e. trying to designate fonts and S (performing first typesetting; setting Ln value to Pn value, and Y-axis offset mo= (Pn-1) by paragraph interval/2, if Lp > = 0, determining that the target is found (the target is the current typesetting result, marking the typesetting result), when the target is found, attempting to further reduce zoom, if no scaling font lower limit threshold is exceeded, judging that the effect is better if yes, updating marked typesetting result, otherwise adopting the typesetting result marked before.
S204, performing text drawing.
In this step, text drawing may be performed according to the typesetting result of the mark (i.e., the found target).
Referring to fig. 5a and 5b, fig. 5a shows a schematic diagram of a card when the text drawing area 51 is rectangular, in fig. 5a, each character in the chinese vocabulary is located in the same line, and the suspension symbol is located in the same line as the previous character; fig. 5b shows a schematic diagram of the card with the attack and life value display area removed from the text drawing area 52, and in fig. 5b, text is displayed only in the text drawing area 52, where 53 is the card.
Referring to fig. 6 and 7, fig. 6 is a schematic structural diagram of a text drawing device in a card game according to an embodiment of the present application, and fig. 7 is a schematic structural diagram of a text drawing device in another card game according to an embodiment of the present application. As shown in fig. 6, the text drawing device 600 in a card game includes:
the conversion module 610 is configured to obtain a target text of a card to be drawn, and convert the target text into at least one character stream according to escape characters in the target text;
a grouping module 620, configured to perform grouping processing on characters in the character stream according to a character grouping rule, where the grouping rule is used to determine characters that need to be continuously displayed in the character stream;
The typesetting module 630 is configured to perform typesetting processing on the character stream according to the grouping result of the grouping processing and the parameter information of the text drawing area in the card to be drawn, so as to obtain a typesetting result in the typesetting processing;
and a drawing module 640, configured to draw the character stream in the text drawing area according to the typesetting result.
As shown in fig. 7, the text drawing device 700 in the card game includes a conversion module 710, a grouping module 720, a typesetting module 730, and a drawing module 740;
in one possible implementation, the character rule includes a text grouping rule and a symbol grouping rule;
the grouping module 720 is specifically configured to:
grouping the literal characters in the character stream according to the literal grouping rule to obtain at least one literal character group;
and dividing the symbol characters in the character stream into the corresponding character groups according to the symbol grouping rule to obtain the grouping result.
In one possible implementation, the typesetting module 730 includes:
a pre-typesetting unit 731, configured to typeset the character stream in the text drawing area according to preset typesetting parameters, the grouping result, and parameter information of the text drawing area;
And the cyclic typesetting unit 732 is configured to adjust the typesetting parameters according to the typesetting result of the typesetting process, and repeat the typesetting process and the step of adjusting the typesetting parameters until a preset cutoff condition is satisfied.
In one possible implementation, the typesetting parameters include at least one of the following: font, width and height of characters, scaling value of characters, line spacing, segment spacing, initial line number.
In a possible implementation manner, the pre-typesetting unit 731 is specifically configured to:
adjusting the initial line number according to the number of the character streams;
determining a typesetting starting position in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of characters in the typesetting parameters, the scaling value of the characters, the line spacing and the segment spacing;
from the typesetting starting position, adding characters in the character stream into the text drawing area one by one according to the preset typesetting parameters; line feed occurs when the remaining positions in a line are insufficient to accommodate all characters in the next group; and when all the characters in one character stream are added, the segments are replaced when the next character stream exists.
In one possible embodiment, the preset cutoff condition includes at least one of the following: the zoom value of the character is smaller than or equal to a first preset threshold value, and the actual line number is smaller than or equal to the initial line number and no character located outside the text drawing area exists; wherein,
the cyclic typesetting unit 732 is specifically configured to:
if the actual line number is greater than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area;
if the typesetting result includes characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area.
In a possible implementation manner, the cyclic typesetting unit 732 is further configured to:
if the characters outside the text drawing area do not exist and the actual line number is smaller than or equal to the initial line number, marking the current typesetting result;
if the scaling value of the character is larger than a second preset threshold value, reducing the scaling value of the character by a preset step length on the premise of ensuring that the scaling value of the character is larger than the second preset threshold value, taking the actual line number as the initial line number, re-determining the typesetting starting position, and returning to the step of adding the character into the text drawing area.
In one possible implementation, the drawing module 740 is specifically configured to:
and drawing the character stream in the text drawing area according to the typesetting result of the latest mark.
The text drawing device in the card game firstly obtains a target text of a card to be drawn, and converts the target text into at least one character stream according to escape characters in the target text; then, according to the character grouping rule, grouping the characters in the character stream; secondly, typesetting the character stream according to the grouping result of the grouping process and the parameter information of the text drawing area in the card to be drawn; in the typesetting result of the typesetting processing, the characters belonging to the same group are positioned in the same row; and finally, drawing the character stream in the text drawing area according to the typesetting result. According to the method and the device, the characters in the character stream corresponding to the text are grouped, typesetting processing is conducted on the character stream according to the grouping result and the parameter information of the text drawing area, typesetting and drawing automation of the text can be achieved, and drawing efficiency of the card text is improved.
Referring to fig. 8, fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 8, the electronic device 800 includes a processor 810, a memory 820, and a bus 830.
The memory 820 stores machine-readable instructions executable by the processor 810, which when executed by the processor 810, cause the processor 810 to communicate with the memory 820 via the bus 830 when the electronic device 800 is in operation, to perform the steps of:
acquiring a target text of a card to be drawn, and converting the target text into at least one character stream according to escape characters in the target text;
grouping the characters in the character stream according to a character grouping rule, wherein the grouping rule is used for determining characters needing to be continuously displayed in the character stream;
typesetting the character stream according to the grouping result of the grouping process and the parameter information of the text drawing area in the card to be drawn so as to obtain an typesetting result of the typesetting process;
and drawing the character stream in the text drawing area according to the typesetting result.
In one possible implementation manner, the grouping rules of the character set include a text grouping rule and a symbol grouping rule;
in one possible implementation, the processor 810, when executing the grouping processing for the characters in the character stream according to the character grouping rule, specifically executes:
grouping the literal characters in the character stream according to the literal grouping rule to obtain at least one literal character group;
and dividing the symbol characters in the character stream into the corresponding character groups according to the symbol grouping rule to obtain the grouping result.
In a possible implementation manner, when the processor 810 performs the typesetting processing on the character stream according to the grouping result of the grouping processing and the parameter information of the text drawing area in the card to be drawn, the specific implementation is that:
typesetting the character stream in the text drawing area according to preset typesetting parameters, the grouping result and parameter information of the text drawing area;
and adjusting the typesetting parameters according to typesetting results of the typesetting treatment, and repeating typesetting treatment and the step of adjusting the typesetting parameters until preset cut-off conditions are met.
In one possible implementation, the typesetting parameters include at least one of the following: font, width and height of characters, scaling value of characters, line spacing, segment spacing, initial line number.
In a possible implementation manner, the processor 810 specifically performs, when performing the typesetting processing on the character stream in the text drawing area according to the preset typesetting parameters, the grouping result, and the parameter information of the text drawing area:
adjusting the initial line number according to the number of the character streams;
determining a typesetting starting position in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of characters in the typesetting parameters, the scaling value of the characters, the line spacing and the segment spacing;
from the typesetting starting position, adding characters in the character stream into the text drawing area one by one according to the preset typesetting parameters; line feed occurs when the remaining positions in a line are insufficient to accommodate all characters in the next group; and when all the characters in one character stream are added, the segments are replaced when the next character stream exists.
In one possible embodiment, the preset cutoff condition includes at least one of the following: the zoom value of the character is smaller than or equal to a first preset threshold value, and the actual line number is smaller than or equal to the initial line number and no character located outside the text drawing area exists; wherein,
the processor 810 adjusts the typesetting parameters according to the typesetting result of the typesetting process, and repeatedly performs typesetting processing and adjusting the typesetting parameters until a preset cut-off condition is satisfied, and specifically performs:
if the actual line number is greater than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area;
if the typesetting result includes characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area.
In a possible implementation manner, the processor 810 adjusts the typesetting parameters according to the typesetting result of the typesetting process, and repeats the typesetting process and the step of adjusting the typesetting parameters until a preset cutoff condition is met, and further performs:
If the characters outside the text drawing area do not exist and the actual line number is smaller than or equal to the initial line number, marking the current typesetting result;
if the scaling value of the character is larger than a second preset threshold value, reducing the scaling value of the character by a preset step length on the premise of ensuring that the scaling value of the character is larger than the second preset threshold value, taking the actual line number as the initial line number, re-determining the typesetting starting position, and returning to the step of adding the character into the text drawing area.
In a possible implementation manner, the processor 810, when executing drawing the character stream in the text drawing area according to the typesetting result, specifically executes:
and drawing the character stream in the text drawing area according to the typesetting result of the latest mark.
The embodiment of the present application further provides a computer readable storage medium, where a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the steps of the text drawing method in the card game in the method embodiments shown in the foregoing fig. 1 and fig. 2 may be executed, and specific implementation manners may refer to the method embodiments and are not repeated herein.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer readable storage medium executable by a processor. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the foregoing examples are merely specific embodiments of the present application, and are not intended to limit the scope of the present application, but the present application is not limited thereto, and those skilled in the art will appreciate that while the foregoing examples are described in detail, the present application is not limited thereto. Any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or make equivalent substitutions for some of the technical features within the technical scope of the disclosure of the present application; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method of text rendering in a card game, comprising:
acquiring a target text of a card to be drawn, and converting the target text into at least one character stream according to escape characters in the target text;
grouping the characters in the character stream according to a character grouping rule, wherein the grouping rule is used for determining characters needing to be continuously displayed in the character stream; the character grouping rule is used for grouping characters to be displayed in the same line in the character stream into the same group;
typesetting the character stream according to the grouping result of the grouping process and the parameter information of the text drawing area in the card to be drawn so as to obtain an typesetting result of the typesetting process;
drawing the character stream in the text drawing area according to the typesetting result;
and typesetting the character stream according to the grouping result of the grouping process and the parameter information of the text drawing area in the card to be drawn, wherein the typesetting process comprises the following steps:
typesetting the character stream in the text drawing area according to preset typesetting parameters, the grouping result and parameter information of the text drawing area;
And adjusting the typesetting parameters according to typesetting results of the typesetting treatment, and repeating typesetting treatment and the step of adjusting the typesetting parameters until preset cut-off conditions are met.
2. The method of claim 1, wherein the character grouping rules include a text grouping rule and a symbol grouping rule;
the grouping processing of the characters in the character stream according to the character grouping rule comprises the following steps:
grouping the literal characters in the character stream according to the literal grouping rule to obtain at least one literal character group;
and dividing the symbol characters in the character stream into the corresponding character groups according to the symbol grouping rule to obtain the grouping result.
3. The method of claim 1, wherein the layout parameters include at least one of: font, width and height of characters, scaling value of characters, line spacing, segment spacing, initial line number.
4. A method according to claim 3, wherein typesetting the character stream in the text drawing area according to preset typesetting parameters, the grouping result, and parameter information of the text drawing area comprises:
Adjusting the initial line number according to the number of the character streams;
determining a typesetting starting position in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of characters in the typesetting parameters, the scaling value of the characters, the line spacing and the segment spacing;
from the typesetting starting position, adding characters in the character stream into the text drawing area one by one according to the typesetting parameters;
line feed occurs when the remaining positions in a line are insufficient to accommodate all characters in the next group;
and when all the characters in one character stream are added, the segments are replaced when the next character stream exists.
5. The method of claim 4, wherein the preset cutoff condition comprises at least one of: the zoom value of the character is smaller than or equal to a first preset threshold value, and the actual line number is smaller than or equal to the initial line number and no character located outside the text drawing area exists;
and according to the typesetting result of the typesetting processing, adjusting the typesetting parameters, and repeating the steps of typesetting processing and adjusting the typesetting parameters until a preset cut-off condition is met, wherein the typesetting processing comprises at least one of the following steps:
If the actual line number is greater than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area; and
if the typesetting result includes characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting starting position, and returning to the step of adding the characters into the text drawing area.
6. The method according to claim 5, wherein the step of adjusting the layout parameters according to the layout result of the layout process and repeating the steps of performing the layout process and adjusting the layout parameters until a preset cutoff condition is satisfied, further comprises:
if the characters outside the text drawing area do not exist and the actual line number is smaller than or equal to the initial line number, marking the current typesetting result;
if the scaling value of the character is larger than a second preset threshold value, reducing the scaling value of the character by a preset step length on the premise of ensuring that the scaling value of the character is larger than the second preset threshold value, taking the actual line number as the initial line number, re-determining the typesetting starting position, and returning to the step of adding the character into the text drawing area.
7. The method according to claim 6, wherein the drawing the character stream in the text drawing area according to the typesetting result includes:
and drawing the character stream in the text drawing area according to the typesetting result of the latest mark.
8. A text drawing device in a card game, the device comprising:
the conversion module is used for acquiring a target text of a card to be drawn and converting the target text into at least one character stream according to escape characters in the target text;
the grouping module is used for grouping the characters in the character stream according to a character grouping rule, wherein the grouping rule is used for determining characters which need to be continuously displayed in the character stream; the character grouping rule is used for grouping characters to be displayed in the same line in the character stream into the same group;
the typesetting module is used for typesetting the character stream according to the grouping result of the grouping process and the parameter information of the text drawing area in the card to be drawn so as to obtain the typesetting result of the typesetting process;
the drawing module is used for drawing the character stream in the text drawing area according to the typesetting result;
The typesetting module comprises:
the typesetting unit is used for typesetting the character stream in the text drawing area according to preset typesetting parameters, the grouping result and the parameter information of the text drawing area;
and the circulating typesetting unit is used for adjusting the typesetting parameters according to typesetting results of the typesetting processing, and repeating the typesetting processing and the step of adjusting the typesetting parameters until the preset cut-off condition is met.
9. An electronic device, comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating over the bus when the electronic device is running, the processor executing the machine-readable instructions to perform the steps of the text drawing method in a card game as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, performs the steps of the text drawing method in a card game as claimed in any one of claims 1 to 7.
CN202010803086.7A 2020-08-11 2020-08-11 Text drawing method and device in card game Active CN111881656B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010803086.7A CN111881656B (en) 2020-08-11 2020-08-11 Text drawing method and device in card game

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010803086.7A CN111881656B (en) 2020-08-11 2020-08-11 Text drawing method and device in card game

Publications (2)

Publication Number Publication Date
CN111881656A CN111881656A (en) 2020-11-03
CN111881656B true CN111881656B (en) 2024-02-23

Family

ID=73203588

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010803086.7A Active CN111881656B (en) 2020-08-11 2020-08-11 Text drawing method and device in card game

Country Status (1)

Country Link
CN (1) CN111881656B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113297832B (en) * 2021-05-25 2024-07-26 北京北大方正电子有限公司 Folding position optimization method, device, equipment and storage medium
CN113642288B (en) * 2021-08-12 2024-03-15 稿定(厦门)科技有限公司 Picture and text typesetting method and device
CN114757161B (en) * 2022-04-12 2024-07-26 特赞(上海)信息科技有限公司 Cartoon self-adaptive typesetting method and device based on dynamic programming

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0773182A (en) * 1993-09-01 1995-03-17 Morisawa & Co Ltd Device and method for deciding character arrangement and work station
CN101404010A (en) * 2008-11-12 2009-04-08 北大方正集团有限公司 Method and system for implementing Uighur linear typeset split joint
CN102103586A (en) * 2009-12-16 2011-06-22 新奥特(北京)视频技术有限公司 Multi-language bidirectionally mixed-arranged caption edition system
CN102467496A (en) * 2010-11-17 2012-05-23 北大方正集团有限公司 Method and apparatus for converting streaming typeset content into block-type typeset document
CN107451113A (en) * 2017-07-06 2017-12-08 广东小天才科技有限公司 Automatic typesetting method and system for presentation document
CN110969004A (en) * 2019-12-16 2020-04-07 方正株式(武汉)科技开发有限公司 Automatic typesetting method and system for image and text, server and medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103186519B (en) * 2011-12-31 2017-04-05 北大方正集团有限公司 Two-way composition method and equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0773182A (en) * 1993-09-01 1995-03-17 Morisawa & Co Ltd Device and method for deciding character arrangement and work station
CN101404010A (en) * 2008-11-12 2009-04-08 北大方正集团有限公司 Method and system for implementing Uighur linear typeset split joint
CN102103586A (en) * 2009-12-16 2011-06-22 新奥特(北京)视频技术有限公司 Multi-language bidirectionally mixed-arranged caption edition system
CN102467496A (en) * 2010-11-17 2012-05-23 北大方正集团有限公司 Method and apparatus for converting streaming typeset content into block-type typeset document
CN107451113A (en) * 2017-07-06 2017-12-08 广东小天才科技有限公司 Automatic typesetting method and system for presentation document
CN110969004A (en) * 2019-12-16 2020-04-07 方正株式(武汉)科技开发有限公司 Automatic typesetting method and system for image and text, server and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
原有排版文件的超文本化处理;何薇, 黄煜红;北京印刷学院学报(第01期);3-10 *

Also Published As

Publication number Publication date
CN111881656A (en) 2020-11-03

Similar Documents

Publication Publication Date Title
CN111881656B (en) Text drawing method and device in card game
US7797624B2 (en) Automated paragraph layout
CN101876967B (en) Method for generating PDF text paragraphs
US7703011B2 (en) Digital content creation system, digital content creation method, and program product
KR100904801B1 (en) Documents compilation supporting device and storage medium
CN104766353A (en) Method and device for adding text content into background
CN111814427A (en) Text display method and device, electronic equipment and readable storage medium
US20080201635A1 (en) Document edit device and storage medium
CN104516868A (en) Layout space streaming restoring method and layout space streaming restoring system
CN113569531B (en) Content typesetting method and device, computer equipment and storage medium
KR101777521B1 (en) Method and Apparatus for generating font for changing font&#39;s style
CN113536747A (en) Uyghur language last-syllable-splitting processing method on mobile equipment
CN109543062A (en) Image processing method, system, computer installation and readable storage medium storing program for executing
US20240338512A1 (en) Method for displaying electronic sign and electronic device
CN109948129B (en) Rich text editing method and editor based on three-dimensional engine and electronic equipment
CN106934847B (en) Pattern generation method and device
CN114925656B (en) Rich text display method, device, equipment and storage medium
CN111596988B (en) Terminal page image-text display method and device
US20180189251A1 (en) Automatic multi-lingual editing method for cartoon content
CN106776489B (en) Electronic document display method and system of display device
CN102929857B (en) A kind of picture of instruction type continues page method automatically
CN114307125B (en) Method and system for generating connection topic
CN116775198A (en) Multi-language interface display adjusting method and device, electronic equipment and storage medium
JP2001195395A (en) Method and device for outputting character string information
CN113535017B (en) Method and device for processing and synchronously displaying drawing files and storage medium

Legal Events

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