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

Text drawing method and device in card game Download PDF

Info

Publication number
CN111881656A
CN111881656A CN202010803086.7A CN202010803086A CN111881656A CN 111881656 A CN111881656 A CN 111881656A CN 202010803086 A CN202010803086 A CN 202010803086A CN 111881656 A CN111881656 A CN 111881656A
Authority
CN
China
Prior art keywords
typesetting
text
character
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.)
Granted
Application number
CN202010803086.7A
Other languages
Chinese (zh)
Other versions
CN111881656B (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

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • 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, 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 a character grouping rule, carrying out grouping processing on characters in the character stream; secondly, performing 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; in the typesetting result of the typesetting processing, the characters belonging to the same group are positioned in the same line; 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, and the character stream is typeset according to the grouping result and the parameter information of the text drawing area, so that the automation of typesetting and drawing of the text can be realized, and the card text drawing efficiency is improved.

Description

Text drawing method and device in card game
Technical Field
The application relates to the technical field of computers, in particular to a text drawing method and device in a card game.
Background
With the rapid development of science and technology and economy, the spiritual demands of people are gradually increased, and games become the popular choices for people to play. In games, there is a large amount of text that serves as a description of the game, and the text is often drawn in text boxes in the game that are critical to the game. The amount of text in a card game is particularly high in many types of games. In a card game, there are hundreds of cards, each of which has a corresponding interpretation text drawn.
At present, texts on cards are usually typeset manually and then drawn according to the typesetting result, and because the contents and heights of the texts of each card are different and the number of the cards is extremely large, the cards consume extremely large manpower resources and have extremely low efficiency.
Disclosure of Invention
In view of this, an object of the present application is to provide a method and an apparatus for drawing a text in a card game, which can implement automation of typesetting and drawing of the 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 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;
performing 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 to obtain a typesetting result of the typesetting processing;
and drawing the character stream in the text drawing area according to the typesetting result.
In one possible embodiment, the character grouping rule includes 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 includes:
grouping the literal characters in the character stream according to the literal grouping rule to obtain at least one literal character group;
and according to the symbol grouping rule, the symbol characters in the character stream are grouped into the corresponding character group to obtain the grouping result.
In a possible implementation manner, the performing layout 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 includes:
performing typesetting processing on the character stream in the text rendering area according to preset typesetting parameters, the grouping result and the parameter information of the text rendering area;
and adjusting the typesetting parameters according to the typesetting result of the typesetting treatment, and repeating the steps of typesetting treatment and adjusting the typesetting parameters until a preset cutoff condition is met.
In a possible embodiment, the layout parameter includes at least one of: font, width and height of character, scaling value of character, line spacing, segment spacing, initial line number.
In a possible implementation manner, the performing layout processing on the character stream in the text rendering area according to preset layout parameters, the grouping result, and the parameter information of the text rendering area includes:
adjusting the initial line number according to the number of the character streams;
determining the initial position of typesetting in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of the characters in the typesetting parameters, the zoom value of the characters, the line spacing and the segment spacing;
from the typesetting initial position, adding the characters in the character stream into the text drawing area one by one according to the preset typesetting parameters; wrapping when the remaining positions in a row are insufficient to accommodate all characters in the next group; and when all the characters in one character stream are added and the next character stream exists, the segment is changed.
In a possible embodiment, the preset cut-off condition comprises at least one of: the zoom value of the characters is less than or equal to a first preset threshold value, the actual line number is less than or equal to the initial line number, and no characters outside the text drawing area exist; wherein,
and adjusting the typesetting parameters according to the typesetting result of the typesetting treatment, and repeating the steps of typesetting treatment and adjusting the typesetting parameters until a preset cutoff condition is met, wherein the step comprises at least one of the following steps:
if the actual line number is larger than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting initial position, and returning to the step of adding the characters to the text drawing area;
if the typesetting result contains characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting initial position, and returning to the step of adding the characters into the text drawing area.
In a possible implementation manner, the adjusting the layout parameter according to the layout result of the layout processing, and repeating the steps of performing the layout processing and adjusting the layout parameter until a preset cutoff condition is satisfied, further includes:
if no character outside the text drawing area exists and the actual line number is less than or equal to the initial line number, marking the current typesetting result;
if the zoom value of the character is larger than a second preset threshold value, on the premise that the zoom value of the character is larger than the second preset threshold value, the zoom value of the character is reduced by a preset step length, the actual line number is used as the initial line number, the typesetting initial position is re-determined, and the step of adding the character to the text drawing area is returned.
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 present application further provides a text drawing device in a card game, including:
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 the characters needing to be continuously displayed in the character stream;
the typesetting module is used for performing 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 the typesetting result of the typesetting processing;
and the drawing module is used for drawing the character stream in the text drawing area according to the typesetting result.
In one possible embodiment, the character grouping rule includes 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 according to the symbol grouping rule, the symbol characters in the character stream are grouped into the corresponding character group to obtain the grouping result.
In one possible implementation, the layout module includes:
the pre-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 the typesetting result of the typesetting processing, and repeating the steps of typesetting processing and adjusting the typesetting parameters until a preset cutoff condition is met.
In a possible embodiment, the layout parameter includes at least one of: font, width and height of character, scaling value of character, 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 the initial position of typesetting in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of the characters in the typesetting parameters, the zoom value of the characters, the line spacing and the segment spacing;
from the typesetting initial position, adding the characters in the character stream into the text drawing area one by one according to the preset typesetting parameters;
wrapping when the remaining positions in a row are insufficient to accommodate all characters in the next group; and when all the characters in one character stream are added and the next character stream exists, the segment is changed.
In a possible embodiment, the preset cut-off condition comprises at least one of: the zoom value of the characters is less than or equal to a first preset threshold value, the actual line number is less than or equal to the initial line number, and no characters outside the text drawing area exist; wherein,
the circular typesetting unit is specifically used for:
if the actual line number is larger than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting initial position, and returning to the step of adding the characters to the text drawing area;
if the typesetting result contains characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting initial position, and returning to the step of adding the characters into the text drawing area.
In a possible implementation, the circular typesetting unit is further configured to:
if no character outside the text drawing area exists and the actual line number is less than or equal to the initial line number, marking the current typesetting result;
if the zoom value of the character is larger than a second preset threshold value, on the premise that the zoom value of the character is larger than the second preset threshold value, the zoom value of the character is reduced by a preset step length, the actual line number is used as the initial line number, the typesetting initial position is re-determined, and the step of adding the character to the text drawing area is returned.
In a possible implementation, the rendering module is specifically configured to:
and drawing the character stream in the text drawing area according to the typesetting result of the latest mark.
An embodiment of the present application further provides an electronic device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when the electronic device is operating, 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 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;
performing 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 to obtain a typesetting result of the typesetting processing;
and drawing the character stream in the text drawing area according to the typesetting result.
In one possible embodiment, the character grouping rule includes a text grouping rule and a symbol grouping rule;
in a possible implementation manner, when the processor performs grouping processing on the characters in the character stream according to a character grouping rule, the processor specifically performs:
grouping the literal characters in the character stream according to the literal grouping rule to obtain at least one literal character group;
and according to the symbol grouping rule, the symbol characters in the character stream are grouped into the corresponding character group to obtain the grouping result.
In a possible implementation manner, when executing 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 processor specifically executes:
performing typesetting processing on the character stream in the text rendering area according to preset typesetting parameters, the grouping result and the parameter information of the text rendering area;
and adjusting the typesetting parameters according to the typesetting result of the typesetting treatment, and repeating the steps of typesetting treatment and adjusting the typesetting parameters until a preset cutoff condition is met.
In a possible embodiment, the layout parameter includes at least one of: font, width and height of character, scaling value of character, line spacing, segment spacing, initial line number.
In a possible implementation manner, when executing the layout processing on the character stream in the text drawing area according to the preset layout parameter, the grouping result, and the parameter information of the text drawing area, the processor specifically executes:
adjusting the initial line number according to the number of the character streams;
determining the initial position of typesetting in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of the characters in the typesetting parameters, the zoom value of the characters, the line spacing and the segment spacing;
from the typesetting initial position, adding the characters in the character stream into the text drawing area one by one according to the preset typesetting parameters;
wrapping when the remaining positions in a row are insufficient to accommodate all characters in the next group; and when all the characters in one character stream are added and the next character stream exists, the segment is changed.
In a possible embodiment, the preset cut-off condition comprises at least one of: the zoom value of the characters is less than or equal to a first preset threshold value, the actual line number is less than or equal to the initial line number, and no characters outside the text drawing area exist; wherein,
the processor adjusts the typesetting parameters according to the typesetting result of the typesetting processing, repeats the steps of typesetting processing and adjusting the typesetting parameters until a preset cutoff condition is met, and specifically executes the following steps:
if the actual line number is larger than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting initial position, and returning to the step of adding the characters to the text drawing area;
if the typesetting result contains characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting initial position, and returning to the step of adding the characters into the text drawing area.
In a possible implementation manner, when the processor performs the typesetting according to the typesetting result of the typesetting processing, adjusts the typesetting parameter, and repeats the steps of performing the typesetting processing and adjusting the typesetting parameter until a preset cutoff condition is met, the processor further performs:
if no character outside the text drawing area exists and the actual line number is less than or equal to the initial line number, marking the current typesetting result;
if the zoom value of the character is larger than a second preset threshold value, on the premise that the zoom value of the character is larger than the second preset threshold value, the zoom value of the character is reduced by a preset step length, the actual line number is used as the initial line number, the typesetting initial position is re-determined, and the step of adding the character to the text drawing area is returned.
In a possible implementation manner, when the processor performs rendering the character stream in the text rendering area according to the typesetting result, specifically:
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, on which a computer program is stored, where the computer program is executed by a processor to perform the steps of the text drawing method in the card game.
According to the text drawing method and device 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 a character grouping rule, carrying out grouping processing on characters in the character stream; secondly, performing 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; obtaining a typesetting result 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, and the character stream is typeset according to the grouping result and the parameter information of the text drawing area, so that the automation of typesetting and drawing of the text can be realized, and the card text drawing efficiency is improved.
In order to make the aforementioned 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 required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
FIG. 1 is a flow chart illustrating a method for drawing text in a card game provided by an embodiment of the present application;
FIG. 2 is a flow chart illustrating another method of text rendering in a card game provided by an embodiment of the present application;
fig. 3 is a schematic diagram illustrating 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 in a text drawing method in a card game according to an embodiment of the present application;
FIG. 5a shows a schematic view of a card with a text drawing area rectangular;
FIG. 5b is a schematic view of the card with the offensive power and vital value display areas removed from the text rendering area;
fig. 6 is a schematic structural diagram illustrating a text drawing apparatus in a card game according to an embodiment of the present application;
FIG. 7 is a schematic structural diagram of a text drawing device in another card game provided by an embodiment of the present application;
fig. 8 shows a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, 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 obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. Every other embodiment that can be obtained by a person skilled in the art without making creative efforts based on the embodiments of the present application falls within the protection scope of the present application.
First, an application scenario to which the present application is applicable will be described. The method and the device can be applied to text drawing of the virtual cards in the card game. In the embodiment of the present application, a description is given of a case of text drawing of a virtual card in a card game, but this is only an embodiment, and the present application can also be applied to other scenes without creative efforts, and all of them fall within the scope of protection of the present application.
Research shows that a large number of cards exist in a card game, different texts are drawn on different cards, the contents and heights of the texts are different, areas in the cards capable of being drawn are also different, if the texts are drawn into the cards according to traditional typesetting standards which are carried out one by one according to characters, some consecutive characters can be typeset into different lines, the readability of the drawn texts is poor, and therefore typesetting needs to be carried out in a manual processing mode, and due to the fact that the number of the cards in the card game is large, a large amount of manpower resources are consumed in manual typesetting and drawing modes, mistakes are easy to occur, and the efficiency is extremely low.
Based on this, the embodiment of the application provides a text drawing method in a card game, so as to realize the automation of text typesetting and drawing and improve the efficiency of card text typesetting and drawing.
Referring to fig. 1, fig. 1 is a flowchart illustrating a text drawing method in a card game according to an embodiment of the present disclosure. As shown in fig. 1, a text drawing method in a card game provided by an embodiment of the present application includes:
s101, obtaining 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 attributes and effects of the card and can generally comprise characters, numbers, symbols and the like; the escape characters may be text defining the target text format and the inserted content. Escape characters may be some pre-agreed text processing rules, identified by a # beginning.
Illustratively, the target text may be in the form of:
make a # cffff0000 god # l respond with 5# p (img _ hujia) # r: when the soldiers are attacked, the card is automatically used for the soldiers.
Wherein, # cffff000 represents that the subsequent text needs to be displayed in red, #1 represents that the red is displayed, # p (img _ hujia) represents that the picture under the path of img _ hujia is displayed, and # r represents that the line is manually wrapped.
In this step, the escape character in the target text may be scanned, after the escape character is scanned, the character in the target text is processed according to a predefined escape rule, if the character in the scanned text is not an escape character, the character is taken as an independent character, and if the escape character for manual line feed exists in the target text, the character after the escape character for manual line feed is split and divided into two character streams, i.e., a front character stream and a rear character stream.
Illustratively, the above example of the target text may be converted into the following two character streams:
character stream 1: make one have a way to play 5
Character stream 2: responding: when the soldiers are attacked, the card is automatically used for the soldiers.
The color of the character "zihshen" is red, and "+" represents the picture under the path of img _ hujia.
S102, grouping the characters in the character stream according to a character grouping rule, wherein the grouping rule is used for determining the characters which need to be continuously displayed in the character stream.
In the step, the character grouping rule is used for grouping the characters which need to be displayed in the same line in the character stream into the same group, so that the characters which need to be displayed in the same line are typeset into the same line in the subsequent typesetting step, and the readability of the drawn card text is further improved.
In one possible embodiment, the character grouping rule may include a literal grouping rule and a symbol grouping rule;
the grouping processing of the characters in the character stream according to the character grouping rule includes:
grouping the literal characters in the character stream according to the literal grouping rule to obtain at least one literal character group;
and according to the symbol grouping rule, the symbol characters in the character stream are grouped into the corresponding character group 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 one group, and foreign words in the character stream can be grouped into one group; the symbol grouping rule is used to group symbols in a character stream, for example, a dangling character is grouped with a character preceding the dangling character, and a non-capable ending character is grouped with a character following the non-capable ending character.
In particular, a hanging character refers to a character that may be attached to the end of a sentence, such as ".", ". ","; ","; ",": and ": "," \\","', "" > "," "" ") and the like; the word "not to end" refers to a word that cannot be put at the end of a sentence, such as "[ (or),", "[", "", "" etc.
S103, performing 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 the typesetting result of the typesetting processing.
In this step, the character stream may be typeset according to the parameter information of the text rendering area, the characters in the character stream are added to the text rendering area, and the characters belonging to the same group are arranged in the same row, so as to ensure readability of the text after typesetting, and further obtain a typesetting result of the typesetting.
The parameter information of the text rendering area may include information such as a position of the text rendering area and a size of the text rendering area.
In a possible implementation manner, the performing layout 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 includes:
performing typesetting processing on the character stream in the text rendering area according to preset typesetting parameters, the grouping result and the parameter information of the text rendering area;
and adjusting the typesetting parameters according to the typesetting result of the typesetting treatment, and repeating the steps of typesetting treatment and adjusting the typesetting parameters until a preset cutoff condition is met.
In this step, the character stream may be typeset according to the preset typesetting parameters, and since the preset typesetting parameters cannot satisfy various cards and target texts corresponding thereto, the readability of the obtained typesetting result is poor, and the conditions of inconsistent typesetting effect, character exceeding the text drawing area, and the like are easily caused, it is necessary to adjust the typesetting parameters according to the first typesetting result, and perform the typesetting process here. After the typesetting treatment is carried out again, the effect of the obtained typesetting result may still be poor, the typesetting parameters can be adjusted for many times, and the typesetting is carried out according to the adjusted typesetting parameters until the typesetting result meets the preset cutoff condition.
In a possible embodiment, the layout parameter includes at least one of: font, width and height of character, scaling value of character, line spacing, segment spacing, initial line number.
Wherein, the zoom value of the character refers to the proportion of zooming the character when typesetting; the line spacing refers to the spacing between each line when a plurality of lines exist in one character stream in the typesetting process; the segment interval refers to the interval between two different character streams in the typesetting process; the initial number of rows may be set to 1.
In a possible implementation manner, the performing layout processing on the character stream in the text rendering area according to preset layout parameters, the grouping result, and the parameter information of the text rendering area includes:
adjusting the initial line number according to the number of the character streams;
determining the initial position of typesetting in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of the characters in the typesetting parameters, the zoom value of the characters, the line spacing and the segment spacing;
from the typesetting initial position, adding the characters in the character stream into the text drawing area one by one according to the preset typesetting parameters;
wrapping when the remaining positions in a row are insufficient to accommodate all characters in the next group; and when all the characters in one character stream are added and the next character stream exists, the segment is changed.
In this step, the number of character streams after the target text conversion may be determined, and the value of the initial line number may be set as the number of character streams. For example, in the above example of character streams, where two character streams are included, the initial number of lines may be adjusted to 2.
After the initial line number is adjusted, the layout starting position in the text rendering area may be determined according to the initial line number, the parameter information of the text rendering area, the height of the characters in the layout parameter, the zoom value of the characters, the line spacing, and the segment spacing.
Specifically, for the sake of the attractiveness and readability of the card, the target text may be drawn at the middle position of the text drawing area as much as possible, and in order to achieve the above effect, the line number of the target text in the text drawing area may be estimated first, and then the layout starting position may be determined according to the estimated line number, where the initial line number is the estimated line number of the target text in the text drawing area.
After the initial line number is adjusted, the longitudinal 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 the transverse typesetting starting position can be determined according to the width of the text drawing area at the longitudinal typesetting starting position.
After the typesetting starting position is determined, 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, in the process of typesetting, if all the characters in the group to which the last character in one line belongs are not in the same line, all the characters in the group are put into the next line, when the typesetting of all the characters in one character stream is completed and other residual character streams exist, the paragraph is changed, and the 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 text drawing area may be rectangular, but in a character card or a slave card, the text drawing area is irregular in shape by removing the attack force display area and the life value display area on the basis of the french card, and therefore, the horizontal start position of each line needs to be set according to the width of the text drawing area of the line each time the line is changed.
In a possible embodiment, the preset cut-off condition comprises at least one of: the zoom value of the characters is less than or equal to a first preset threshold value, the actual line number is less than or equal to the initial line number, and no characters outside the text drawing area exist; wherein,
and adjusting the typesetting parameters according to the typesetting result of the typesetting treatment, and repeating the steps of typesetting treatment and adjusting the typesetting parameters until a preset cutoff condition is met, wherein the step comprises at least one of the following steps:
if the actual line number is larger than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting initial position, and returning to the step of adding the characters to the text drawing area; and
if the typesetting result contains characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting initial position, and returning to the step of adding the characters into the text drawing area.
And if the actual line number is greater than the initial line number, the text after the overall typesetting is not in the central part of the text drawing area, the typesetting initial position needs to be determined again, and the typesetting is performed again. The first preset threshold may be set to 0.
If there are characters outside the text rendering area, it can be shown that the text amount of the target text is large, and the text rendering area cannot accommodate all the target texts, so that the zoom value of the characters can be reduced, the volume of the text is reduced, and further the text is entirely within the text rendering area.
In a possible implementation manner, the adjusting the layout parameter according to the layout result of the layout processing, and repeating the steps of performing the layout processing and adjusting the layout parameter until a preset cutoff condition is satisfied, further includes:
if no character outside the text drawing area exists and the actual line number is less than or equal to the initial line number, marking the current typesetting result;
if the zoom value of the character is larger than a second preset threshold value, on the premise that the zoom value of the character is larger than the second preset threshold value, the zoom value of the character is reduced by a preset step length, the actual line number is used as the initial line number, the typesetting initial position is re-determined, and the step of adding the character to the text drawing area is returned.
In this step, if there is no character outside the text rendering region and the actual line number is less than or equal to the initial line number, it may be determined that the layout result meets the rendering standard, and the layout result is marked.
However, in order to further optimize the viewing and readability of the text, the scaling value of the character may be adjusted again 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 the second preset threshold value, after the zoom value of the character is reduced, typesetting again, if the actual line number at the moment is less than or equal to the initial line number, determining that the current typesetting result is superior to the typesetting result marked at the previous time, replacing the typesetting result marked at the previous time with the current typesetting result, and updating the typesetting result marked.
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 circular layout is finished, the text can be drawn using the layout result of the latest mark, so that the drawing effect can be optimized.
The text drawing method in the card game comprises the steps of firstly obtaining 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; then, according to a character grouping rule, carrying out grouping processing on characters in the character stream; secondly, performing 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; in the typesetting result of the typesetting processing, the characters belonging to the same group are positioned in the same line; 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, and the character stream is typeset according to the grouping result and the parameter information of the text drawing area, so that the automation of typesetting and drawing of the text can be realized, and the card text drawing efficiency is improved.
Referring to fig. 2, fig. 2 is a flowchart illustrating a text rendering method in a card game according to another embodiment of the present application. As shown in fig. 2, a text drawing method in a card game provided by an embodiment of the present application includes:
s201, analyzing the text.
This step is the same principle as step S101. The step of analyzing the target text of the card to be drawn is to analyze the analyzed text, and the target text can be split into at least one character stream according to the escape characters in the target text.
And S202, calculating the information of the same row.
This step is the same principle as step S102. The calculation of the information of the same row refers to grouping the characters in the character stream by using a regular expression of the same row and other special rules, the characters in the same group can store the mapping relation between the position of the characters and the position of the first character of the same group, and the characters in the same group are added to the same row during typesetting.
And S203, adaptive size processing.
This step is in principle the same as step S103. The self-adaptive size processing is actually carried out in the text drawing area, a proper typesetting initial position and a proper zooming value of the characters are found, and the typesetting effect is recorded, wherein the typesetting effect can comprise line information such as line height, line width and contained characters, and character information such as the state and size 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 rectangular planar coordinate system is disposed on the text drawing area, an x-axis of the rectangular planar coordinate system coincides with a bottom edge of the text drawing area, a y-axis coincides with a side edge of the text drawing area, the text drawing area has a height H and a width W, a rectangular gap is disposed at each of a lower left corner and a lower right corner of the text drawing area for displaying an attack force and a life value of the card, and the height of the rectangular gap is HWidth of W
Illustratively, the number of paragraphs may be Pn, the width of a normal text character is Gw, the height of the normal text character 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, trying to typeset for the first time by using a specified font and S (the initial value is 1); the value of Ln is defined as Pn, and the Y-axis offset Mo from the segment is (Pn-1) × segment interval/2.
And 2, setting the Y coordinate (Lp) of the typesetting initial position as min (H, H/2+ Mo + Ln × Gh/2).
Step 3, performing typesetting processing under the current zoom value S from the typesetting initial position, adding the characters into the text drawing area one by one, and continuing if the current line width can accommodate the characters; if the character is a hanging character and the last character is not the hanging character, adding the character for continuing; if the characters are the same line, the line is also put in; if the line width is exceeded, line changing processing is needed, if the same line and the characters are forced or two continuous hanging characters are forced, the ending character and the previous character of the line exceeding need to be moved out of the line, otherwise, only the ending character of the line exceeding needs to be moved out of the line; for the character which is moved out, the previous same line character or the character which can not end is also moved out to be put into the next line.
Wherein, for 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 segment change, the Y coordinate (Lp) of a new segment needs to subtract the segment spacing and the Gh from the Y coordinate of the previous row; the line width of each line needs to be determined by judging whether Lp is equal to [0, H]And (4) determining the intersection.
And 4, repeatedly typesetting through the typesetting result of the typesetting treatment until the preset condition is met.
Referring to fig. 4, fig. 4 is a flowchart of repeatedly performing 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 rows is greater than the current number of rows, continuing step 2 with Ln +1, that is, the Y coordinate (Lp) of the layout start position is min (H, H/2+ Mo + Ln × Gh/2); if Lp <0 (text exceeds the lower limit of the limited area), the scaling step value is subtracted from S, if S is less than or equal to 0, the layout is performed with S ═ 1 (no appropriate layout result, no target exists, no marking of the typesetting result is carried out), otherwise, the step 1 is continued, namely, the first typesetting is tried according to the specified font and S (the first typesetting is carried out; setting the value of Ln as the value of Pn, and setting the Y-axis offset Mo caused by the paragraph as (Pn-1) segment interval/2; if Lp > -0, then, then the target is determined to be found (the target is the current typesetting result, and the typesetting result is marked), when the target is found, and under the condition that the lower limit threshold of the scaled font is not exceeded, trying to further reduce the font scaling, and judging whether the condition of reducing line number can be found or not, if so, judging that the effect is better, updating the marked typesetting result, otherwise, adopting the previously marked typesetting result.
And S204, drawing the text.
In this step, text rendering may be performed according to the layout result of the mark (i.e., the found target).
Referring to fig. 5a and 5b, fig. 5a is a schematic diagram of a card with a rectangular text drawing area 51, in fig. 5a, each character in the chinese vocabulary is located in the same row, and the suspension symbol is located in the same row as the previous character; fig. 5b shows a schematic view of a card with the offensive power and vital value display area removed from the text rendering area 52, and in fig. 5b, the text is displayed only in the text rendering area 52, where 53 is a 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 the 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;
a typesetting module 630, configured to perform typesetting processing on the character stream according to the grouping result of the grouping processing and 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 the drawing module 640 is configured to draw the character stream in the text drawing area according to the typesetting result.
As shown in fig. 7, the text drawing apparatus 700 in the card game includes a conversion module 710, a grouping module 720, a composition module 730, and a drawing module 740;
in one possible embodiment, the character rules include 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 according to the symbol grouping rule, the symbol characters in the character stream are grouped into the corresponding character group to obtain the grouping result.
In one possible implementation, the layout module 730 includes:
a pre-typesetting unit 731, configured to perform typesetting processing on the character stream in the text rendering area according to a preset typesetting parameter, the grouping result, and the parameter information of the text rendering area;
a circular typesetting unit 732 for adjusting the typesetting parameters according to the typesetting result of the typesetting processing, and repeating the steps of typesetting processing and adjusting the typesetting parameters until a preset cutoff condition is satisfied.
In a possible embodiment, the layout parameter includes at least one of: font, width and height of character, scaling value of character, 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 the initial position of typesetting in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of the characters in the typesetting parameters, the zoom value of the characters, the line spacing and the segment spacing;
from the typesetting initial position, adding the characters in the character stream into the text drawing area one by one according to the preset typesetting parameters; wrapping when the remaining positions in a row are insufficient to accommodate all characters in the next group; and when all the characters in one character stream are added and the next character stream exists, the segment is changed.
In a possible embodiment, the preset cut-off condition comprises at least one of: the zoom value of the characters is less than or equal to a first preset threshold value, the actual line number is less than or equal to the initial line number, and no characters outside the text drawing area exist; wherein,
the circular typesetting unit 732 is specifically configured to:
if the actual line number is larger than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting initial position, and returning to the step of adding the characters to the text drawing area;
if the typesetting result contains characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting initial position, and returning to the step of adding the characters into the text drawing area.
In one possible implementation, the circular typesetting unit 732 is further configured to:
if no character outside the text drawing area exists and the actual line number is less than or equal to the initial line number, marking the current typesetting result;
if the zoom value of the character is larger than a second preset threshold value, on the premise that the zoom value of the character is larger than the second preset threshold value, the zoom value of the character is reduced by a preset step length, the actual line number is used as the initial line number, the typesetting initial position is re-determined, and the step of adding the character to the text drawing area is returned.
In a possible implementation, the rendering 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 provided by the embodiment of the application 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 a character grouping rule, carrying out grouping processing on characters in the character stream; secondly, performing 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; in the typesetting result of the typesetting processing, the characters belonging to the same group are positioned in the same line; 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, and the character stream is typeset according to the grouping result and the parameter information of the text drawing area, so that the automation of typesetting and drawing of the text can be realized, and the card text drawing efficiency is improved.
Referring to fig. 8, fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. 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, the processor 810 and the memory 820 communicating via the bus 830 when the electronic device 800 is operating, and the machine-readable instructions, when executed by the processor 810, 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 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;
performing 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 to obtain a typesetting result of the typesetting processing;
and drawing the character stream in the text drawing area according to the typesetting result.
In a possible implementation manner, the grouping rules set for the characters include a text grouping rule and a symbol grouping rule;
in a possible implementation manner, when the processor 810 performs grouping processing on characters in the character stream according to a character grouping rule, specifically:
grouping the literal characters in the character stream according to the literal grouping rule to obtain at least one literal character group;
and according to the symbol grouping rule, the symbol characters in the character stream are grouped into the corresponding character group to obtain the grouping result.
In a possible implementation manner, when executing 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 processor 810 specifically executes:
performing typesetting processing on the character stream in the text rendering area according to preset typesetting parameters, the grouping result and the parameter information of the text rendering area;
and adjusting the typesetting parameters according to the typesetting result of the typesetting treatment, and repeating the steps of typesetting treatment and adjusting the typesetting parameters until a preset cutoff condition is met.
In a possible embodiment, the layout parameter includes at least one of: font, width and height of character, scaling value of character, line spacing, segment spacing, initial line number.
In a possible implementation manner, when performing the layout processing on the character stream in the text drawing area according to the preset layout parameter, the grouping result, and the parameter information of the text drawing area, the processor 810 specifically performs:
adjusting the initial line number according to the number of the character streams;
determining the initial position of typesetting in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of the characters in the typesetting parameters, the zoom value of the characters, the line spacing and the segment spacing;
from the typesetting initial position, adding the characters in the character stream into the text drawing area one by one according to the preset typesetting parameters; wrapping when the remaining positions in a row are insufficient to accommodate all characters in the next group; and when all the characters in one character stream are added and the next character stream exists, the segment is changed.
In a possible embodiment, the preset cut-off condition comprises at least one of: the zoom value of the characters is less than or equal to a first preset threshold value, the actual line number is less than or equal to the initial line number, and no characters outside the text drawing area exist; wherein,
the processor 810, when executing the typesetting result according to the typesetting process, adjusts the typesetting parameter, and repeats the steps of typesetting and adjusting the typesetting parameter until a preset cutoff condition is satisfied, specifically executes:
if the actual line number is larger than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting initial position, and returning to the step of adding the characters to the text drawing area;
if the typesetting result contains characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting initial position, and returning to the step of adding the characters into the text drawing area.
In a possible implementation manner, the processor 810, when executing the typesetting result according to the typesetting process, adjusting the typesetting parameter, and repeating the steps of performing the typesetting process and adjusting the typesetting parameter until a preset cutoff condition is met, further executes:
if no character outside the text drawing area exists and the actual line number is less than or equal to the initial line number, marking the current typesetting result;
if the zoom value of the character is larger than a second preset threshold value, on the premise that the zoom value of the character is larger than the second preset threshold value, the zoom value of the character is reduced by a preset step length, the actual line number is used as the initial line number, the typesetting initial position is re-determined, and the step of adding the character to the text drawing area is returned.
In a possible implementation manner, when the processor 810 performs the drawing of the character stream in the text drawing area according to the typesetting result, specifically perform:
and drawing the character stream in the text drawing area according to the typesetting result of the latest mark.
An 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 step of the text drawing method in the card game in the method embodiments shown in fig. 1 and fig. 2 may be executed.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed 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 can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into 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 or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present application, and are used for illustrating the technical solutions of the present application, but not limiting the same, and the scope of the present application is not limited thereto, and although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope disclosed in the present application; such modifications, changes or substitutions do not depart from the spirit and scope of the exemplary embodiments of the present application, and are intended to be covered by 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 (11)

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 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;
performing 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 to obtain a typesetting result of the typesetting processing;
and drawing the character stream in the text drawing area according to the typesetting result.
2. The method of claim 1, wherein the character grouping rules include literal grouping rules and symbolic grouping rules;
the grouping processing of the characters in the character stream according to the character grouping rule includes:
grouping the literal characters in the character stream according to the literal grouping rule to obtain at least one literal character group;
and according to the symbol grouping rule, the symbol characters in the character stream are grouped into the corresponding character group to obtain the grouping result.
3. The method according to claim 1, wherein performing composition processing on the character stream according to the grouping result of the grouping processing and parameter information of a text drawing area in the card to be drawn comprises:
performing typesetting processing on the character stream in the text rendering area according to preset typesetting parameters, the grouping result and the parameter information of the text rendering area;
and adjusting the typesetting parameters according to the typesetting result of the typesetting treatment, and repeating the steps of typesetting treatment and adjusting the typesetting parameters until a preset cutoff condition is met.
4. The method of claim 3, wherein the composition parameters comprise at least one of: font, width and height of character, scaling value of character, line spacing, segment spacing, initial line number.
5. The method according to claim 4, wherein performing composition processing on the character stream in the text rendering area according to preset composition parameters, the grouping result, and parameter information of the text rendering area comprises:
adjusting the initial line number according to the number of the character streams;
determining the initial position of typesetting in the text drawing area according to the adjusted initial line number, the parameter information of the text drawing area, the height of the characters in the typesetting parameters, the zoom value of the characters, the line spacing and the segment spacing;
from the typesetting initial position, adding the characters in the character stream into the text drawing area one by one according to the typesetting parameters;
wrapping when the remaining positions in a row are insufficient to accommodate all characters in the next group;
and when all the characters in one character stream are added and the next character stream exists, the segment is changed.
6. The method of claim 5, wherein the preset cutoff condition comprises at least one of: the zoom value of the characters is less than or equal to a first preset threshold value, the actual line number is less than or equal to the initial line number, and no characters outside the text drawing area exist;
the method comprises the following steps of adjusting the typesetting parameters according to the typesetting result of the typesetting processing, and repeating the steps of typesetting processing and adjusting the typesetting parameters until a preset cutoff condition is met, wherein the method comprises at least one of the following steps:
if the actual line number is larger than the adjusted initial line number in the typesetting result, adding 1 to the initial line number, re-determining the typesetting initial position, and returning to the step of adding the characters to the text drawing area; and
if the typesetting result contains characters outside the text drawing area, reducing the zoom value of the characters by a preset step length, re-determining the typesetting initial position, and returning to the step of adding the characters into the text drawing area.
7. The method according to claim 6, wherein the adjusting the layout parameters according to the layout result of the layout processing, and repeating the steps of performing the layout processing and adjusting the layout parameters until a preset cutoff condition is satisfied, further comprising:
if no character outside the text drawing area exists and the actual line number is less than or equal to the initial line number, marking the current typesetting result;
if the zoom value of the character is larger than a second preset threshold value, on the premise that the zoom value of the character is larger than the second preset threshold value, the zoom value of the character is reduced by a preset step length, the actual line number is used as the initial line number, the typesetting initial position is re-determined, and the step of adding the character to the text drawing area is returned.
8. The method according to claim 7, wherein the drawing the character stream in the text drawing area according to the typesetting result comprises:
and drawing the character stream in the text drawing area according to the typesetting result of the latest mark.
9. An apparatus for drawing text in a card game, the apparatus 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 the characters needing to be continuously displayed in the character stream;
the typesetting module is used for performing 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 the typesetting result of the typesetting processing;
and the drawing module is used for drawing the character stream in the text drawing area according to the typesetting result.
10. 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 via the bus when the electronic device is operating, the processor executing the machine-readable instructions to perform the steps of the text drawing method in the card game according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, performs the steps of the text drawing method in the card game according to any one of claims 1 to 8.
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 true CN111881656A (en) 2020-11-03
CN111881656B 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)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113297832A (en) * 2021-05-25 2021-08-24 北京北大方正电子有限公司 Method, device and equipment for optimizing folding position and storage medium
CN113642288A (en) * 2021-08-12 2021-11-12 稿定(厦门)科技有限公司 Image-text typesetting method and device
CN114757161A (en) * 2022-04-12 2022-07-15 特赞(上海)信息科技有限公司 Cartoon self-adaptive typesetting method and device based on dynamic programming

Citations (7)

* 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
US20150019959A1 (en) * 2011-12-31 2015-01-15 Beijing Founder Electronics Co., Ltd Method and apparatus for bidirectional typesetting
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

Patent Citations (7)

* 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
US20150019959A1 (en) * 2011-12-31 2015-01-15 Beijing Founder Electronics Co., Ltd Method and apparatus for bidirectional typesetting
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
何薇, 黄煜红: "原有排版文件的超文本化处理", 北京印刷学院学报, no. 01, pages 3 - 10 *

Cited By (4)

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

Also Published As

Publication number Publication date
CN111881656B (en) 2024-02-23

Similar Documents

Publication Publication Date Title
CN111881656A (en) Text drawing method and device in card game
CN101876967B (en) Method for generating PDF text paragraphs
US7191396B2 (en) Automated paragraph layout
WO2015180422A1 (en) Page layout method and device
CN104516868B (en) The streaming restoring method and system in a kind of space of a whole page space
US8122351B2 (en) Document edit device and storage medium
US20240143898A1 (en) Content typesetting method and apparatus, computer device, and storage medium
CN109783810A (en) A kind of text handling method, device and computer readable storage medium
CN113536747B (en) Uyghur language last-syllable-splitting processing method on mobile equipment
JP2009282855A (en) Image forming device, method for rendering gradation graphic image, gradation graphic image rendering program, and recording medium
CN110996026B (en) OSD display method, device, equipment and storage medium
US20240338512A1 (en) Method for displaying electronic sign and electronic device
CN111444452A (en) Conversion method, device and storage medium of webpage
JP6963728B2 (en) Image processing device
CN106934847B (en) Pattern generation method and device
CN111596988B (en) Terminal page image-text display method and device
KR20110021714A (en) Method and apparatus for the page-by-page provision of an electronic document as a computer graphic
US20180189251A1 (en) Automatic multi-lingual editing method for cartoon content
CN106776489B (en) Electronic document display method and system of display device
CN118536471A (en) Layout document display method and device
CN114298885B (en) Image processing method, device, equipment and storage medium
CN108897537A (en) Document display method, computer-readable medium and a kind of computer
CN117291147A (en) Data processing method and device for text display
CN110134933B (en) Data processing method, device, terminal and storage medium
CN116775198A (en) Multi-language interface display adjusting method and device, electronic equipment and storage medium

Legal Events

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