WO2022083273A1 - 文字显示方法、装置、电子设备以及计算机可读存储介质 - Google Patents

文字显示方法、装置、电子设备以及计算机可读存储介质 Download PDF

Info

Publication number
WO2022083273A1
WO2022083273A1 PCT/CN2021/114373 CN2021114373W WO2022083273A1 WO 2022083273 A1 WO2022083273 A1 WO 2022083273A1 CN 2021114373 W CN2021114373 W CN 2021114373W WO 2022083273 A1 WO2022083273 A1 WO 2022083273A1
Authority
WO
WIPO (PCT)
Prior art keywords
text
displayed
time
display
display position
Prior art date
Application number
PCT/CN2021/114373
Other languages
English (en)
French (fr)
Inventor
诸葛晶晶
倪光耀
谌业鹏
沈言浩
杨辉
Original Assignee
北京字节跳动网络技术有限公司
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 北京字节跳动网络技术有限公司 filed Critical 北京字节跳动网络技术有限公司
Priority to US18/245,112 priority Critical patent/US20230351651A1/en
Publication of WO2022083273A1 publication Critical patent/WO2022083273A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • G06F3/04812Interaction techniques based on cursor appearance or behaviour, e.g. being affected by the presence of displayed objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • G06F3/0483Interaction with page-structured environments, e.g. book metaphor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour

Definitions

  • the present disclosure relates to the technical field of text display, and in particular, to a text display method, an apparatus, an electronic device, and a computer-readable storage medium.
  • the video usually contains some text information such as lines or lyrics, and the text information will also be displayed as the video is played.
  • the current display method is that when the video is played to the text display position, the corresponding text information is directly displayed, which looks relatively rigid and not flexible enough.
  • the technical problem solved by the present disclosure is to provide a text display method, so as to at least partially solve the technical problem of directly displaying text information in the prior art, which is relatively rigid and inflexible.
  • a text display device, a text display hardware device, a computer-readable storage medium and a text display terminal are also provided.
  • a text display method including:
  • the to-be-displayed text is displayed at the display position after a first time has elapsed.
  • a text display device comprising:
  • the text to be displayed acquisition module is used to acquire the text to be displayed
  • a display position determination module configured to determine the display position of the text to be displayed on the screen according to the current time stamp
  • a text display module configured to display a dynamic text effect at the display position; and display the to-be-displayed text at the display position after a first time elapses.
  • An electronic device comprising:
  • a processor configured to run the computer-readable instructions, so that the processor implements any one of the above text display methods when executed.
  • a computer-readable storage medium for storing non-transitory computer-readable instructions, when the non-transitory computer-readable instructions are executed by a computer, causing the computer to execute any one of the above text display methods.
  • a text display terminal comprising any of the above text display devices.
  • Embodiments of the present disclosure disclose a text display method, an apparatus, an electronic device, and a computer-readable storage medium.
  • the text display method includes: acquiring text to be displayed; determining a display position of the text to be displayed on the screen according to a current timestamp; displaying a dynamic text effect at the display position; The text to be displayed is displayed at the display position.
  • the display position of the text to be displayed is determined by the time stamp, and a dynamic text effect is displayed before the text to be displayed is displayed, so that the text display is more dynamic and flexible.
  • FIG. 1 is a schematic flowchart of a text display method according to an embodiment of the present disclosure
  • FIG. 2 is a further schematic flowchart of a text display method according to an embodiment of the present disclosure
  • FIG. 3 is a further schematic flowchart of a text display method according to an embodiment of the present disclosure.
  • FIG. 4 is a further schematic flowchart of a text display method according to an embodiment of the present disclosure.
  • FIG. 5 is a further schematic flowchart of a text display method according to an embodiment of the present disclosure.
  • FIG. 6 is a further schematic flowchart of a text display method according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic diagram of an application scenario of a text display method according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of a text display device according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
  • the term “including” and variations thereof are open-ended inclusions, ie, "including but not limited to”.
  • the term “based on” is “based at least in part on.”
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one additional embodiment”; the term “some embodiments” means “at least some embodiments”. Relevant definitions of other terms will be given in the description below.
  • FIG. 1 is a flowchart of an embodiment of a text display method provided by an embodiment of the present disclosure.
  • the text display method provided by this embodiment may be executed by a text display device, and the text display device may be implemented as software, or as software and hardware.
  • the text display device can be integrated in a certain device in the text display system, such as a text display server or a text display terminal device. As shown in Figure 1, the method includes the following steps:
  • Step S101 acquiring the text to be displayed.
  • the text to be displayed is obtained from the text to be displayed.
  • the text to be displayed is a text file, and at least one text to be displayed is stored in the text file.
  • the text file includes a lyrics file, a subtitle file, and the like.
  • different characters to be displayed are split from the text to be displayed by encoding the characters to be displayed.
  • the step S101 includes:
  • the text to be displayed includes at least one text to be displayed
  • At least one text to be displayed is split from the text to be displayed according to the first code of the text to be displayed.
  • the first encoding of the text to be displayed is a Unicode encoding
  • different characters to be displayed correspond to different Unicode encodings, so that the text to be displayed can be separated from the text to be displayed through the Unicode encoding.
  • the text to be displayed is at least one text to be displayed received from a human-computer interaction interface, such as at least one text to be displayed received through a keyboard, a mouse or a touch screen.
  • a human-computer interaction interface such as at least one text to be displayed received through a keyboard, a mouse or a touch screen.
  • step S101 it further includes:
  • a text texture for the alternate text is generated.
  • the text textures are all stored in a texture atlas, and the texture atlas includes at least one non-repetitive text texture.
  • the texture atlas includes at least one non-repetitive text texture.
  • the text texture atlas further includes a texture index table, which is used to mark the correspondence between text and text texture (for example, the correspondence between the logo of the text and the text texture), when it is necessary to display the to-be-displayed.
  • the storage location of the text texture can be queried through the identification of the text, such as the above-mentioned first code, and the text texture can be retrieved and displayed on the display screen.
  • the alternate text is used to generate a dynamic text effect later, and the alternate text may be the same as or different from the to-be-displayed text.
  • the alternate text is randomly selected from a text library.
  • the generation process of the text texture of the spare text is the same as the generation process of the text texture of the to-be-displayed text, which is not repeated here.
  • Step S102 determining the display position of the text to be displayed on the screen according to the current time stamp.
  • each text to be displayed includes a display origin, and the display origin is used to locate the display position of the text to be displayed, and the pre-layout is to predetermine the position of the display origin on the screen.
  • the text to be displayed is arranged in a horizontal format, and when the length of the text line of the horizontally arranged text to be displayed exceeds a preset length, a line wrapping operation is performed on the text to be displayed. A sequence of the display positions of the display origin of all the characters to be displayed on the screen is recorded, and then the characters to be displayed are displayed on the corresponding display positions on the screen according to the required display effect.
  • step S102 includes:
  • Step S201 determining the start time and the end time of the text to be displayed; the text to be displayed includes at least one of the text to be displayed;
  • Step S202 determining the index of the cursor according to the current time stamp, the start time and the end time;
  • Step S203 determining the display position of the text to be displayed on the screen according to the index of the cursor.
  • a cursor needs to be displayed at the position of the text to be displayed during typing.
  • the position of the cursor is determined according to the index of the cursor, and the position of the cursor indicates the position of the text to be displayed.
  • the text to be displayed has a displayed start time and an end time.
  • the start time and the end time are calculated by a time parameter.
  • the to-be-displayed text is a sentence of lyrics, and the time The parameters are the offset of the starting time and the offset of the ending time of the lyrics of the sentence, then the starting time and ending time of the lyrics can be calculated according to the timestamp of the beginning of the song.
  • step S202 in order to obtain the text effect of the typing effect, the text to be displayed that needs to be displayed at the current time, that is, the index of the cursor, needs to be calculated from the current timestamp, and the index of the cursor is the text to be displayed in the With an index in the displayed text, it indicates the position of the to-be-displayed text in the to-be-displayed text.
  • step S202 includes:
  • Step S301 when the difference between the ending time and the starting time is greater than the total display time of the text to be displayed, determine the index of the cursor according to the current time stamp, the starting time and the total time ;or,
  • Step S302 when the difference between the end time and the start time is less than the sum of the display times, display all the characters to be displayed in advance according to the current time stamp, the start time, the difference and advance display.
  • the percentage of time determines the index of the cursor.
  • charTime is the display time of the text to be displayed.
  • the display time with the displayed text is the duration of the typing effect of each text to be displayed in the typing effect;
  • charCount is the text to be displayed in the text to be displayed.
  • duration>charTime*charCount that is, the difference between the end time and the start time is greater than the sum of the display time of the text to be displayed, then Indicates the index of the cursor of the text to be displayed at the current timestamp.
  • charTime 2 seconds
  • timestamp 8:00:05
  • startTime 8:00:00
  • (timestamp-startTime) 5 seconds
  • duration ⁇ charTime*charCount that is, the difference between the end time and the start time is less than the sum of the display time.
  • the display position of the text to be displayed can be determined according to the index.
  • the display position is the display position of the display origin of each character to be displayed determined by pre-layout, that is, the display position of each character to be displayed is determined by pre-layout, so in After the text to be displayed is determined through the index of the cursor, the display position of the text to be displayed on the display screen can be determined.
  • the text display method in the embodiment of the present disclosure further includes: step S103 , displaying a dynamic text effect at the display position.
  • step S103 includes:
  • a plurality of alternate characters are randomly displayed at the display position; wherein each time period corresponds to one alternate character among the plurality of alternate characters.
  • the alternate characters are characters randomly selected from a character library, and the alternate characters may be of the same type as the to-be-displayed characters, or may be of a different type from the to-be-displayed characters.
  • the characters to be displayed are Chinese characters
  • the backup characters are also Chinese characters.
  • the method further includes: randomly selecting multiple characters from the character library to generate a candidate character library; and generating text textures of the multiple candidate characters. Then in this step, at the beginning of each time period in the multiple time periods in the first time, randomly select an alternative text from the alternative text library, and obtain the text of the selected alternative text. texture, displaying the text texture of the candidate text at the display position.
  • a plurality of alternate characters are randomly displayed at the display position, including:
  • Step S401 dividing the first time into n time periods; wherein, n is a positive integer greater than 1;
  • Step S402 randomly display n spare characters at the display position within the n time periods; wherein, the n time periods correspond to the n spare characters one-to-one.
  • the n is the preset number of spare characters, which represents the number of spare characters to be displayed in the first time.
  • the n time periods may be equal or unequal, that is, the first time period may be equally divided into n time periods or unequally divided into n time periods, which is not limited herein.
  • each time period corresponds to one spare character, so that when the n time periods pass continuously, the effect of alternately displaying n spare characters can be produced.
  • the larger the value of n is, the faster the text is displayed alternately.
  • step S103 includes:
  • Step S501 determining the start time and the end time of the text to be displayed; the text to be displayed includes at least one of the text to be displayed;
  • Step S502 determine an integer according to the first quantity of the spare text, the current time stamp, the start time, and the end time;
  • Step S503 when the integer is less than the first number, the integer is used as a random number seed;
  • Step S504 randomly obtaining the first number of spare characters according to the random number seed
  • Step S505 alternately displaying the first number of spare characters at the display position.
  • steps S501 to S505 describe the implementation process of alternately displaying alternate characters. Since the process of alternately displaying the alternate text needs to be implemented during the displaying process of the text to be displayed, the start time and the end time of the text to be displayed are obtained in step S501.
  • an integer is determined in step S502, and the integer represents the index of the time period in which the alternate characters are displayed alternately.
  • the display time of the to-be-displayed characters is divided into (n+1) segments, and the first n segments are used to alternately display the n alternate characters, then in the The value range of the integer in this step is [0, n-1], corresponding to the n spare characters respectively.
  • step S502 includes:
  • Step S601 when the difference between the end time and the start time is greater than the total display time of the text to be displayed, according to the first number, the current time stamp, the start time and a single text to be displayed
  • the display duration of the to-be-displayed text and the total number of the to-be-displayed text contained in the to-be-displayed text determine an integer; or,
  • Step S602 when the difference between the end time and the start time is less than the sum of the display times, according to the first number, the current time stamp, the start time, the difference and the advance An integer is determined for the percentage of time that all the characters to be displayed in the to-be-displayed text are displayed, and the total number of the to-be-displayed characters contained in the to-be-displayed text.
  • the condition 1 in the formula (2) corresponds to step S601, and the condition 2 corresponds to step S602.
  • range is the integer
  • charTime is the display time of the text to be displayed.
  • the display time with the displayed text is the duration of the typing effect of each text to be displayed in the typing effect
  • charCount is the to-be-displayed text.
  • the number of characters to be displayed in the displayed text, duration endTime-startTime, which is the difference between the above end time and the start time, and represents the display duration of the text to be displayed
  • timestamp represents the current timestamp
  • startTime represents the text to be displayed
  • the start time of , endTime represents the end time of the text to be displayed
  • n represents the first number of alternative texts.
  • the current time stamp is in the first time period among the four time periods of the display time of the text to be displayed.
  • duration ⁇ charTime*charCount that is, the difference between the end time and the start time is less than the sum of the display time.
  • the current time stamp is in the first time period among the four time periods of the display time of the text to be displayed.
  • the current time stamp is located in the second time period among the four time periods of the display time of the text to be displayed.
  • step S503 it is judged whether the integer is less than the first number, that is, whether the above range is less than n, when range ⁇ n, the range is used as a random number seed, and in step S503 In S504, an alternate character is randomly selected from the random number seed as the alternate character to be displayed currently, and then in step S505, the alternate character is displayed at the display position, since the value of range is in It varies from 0 to (n-1), thus producing the effect of alternate text display.
  • the step S103 includes:
  • the text textures of the plurality of alternate texts are alternately displayed at the display position.
  • a cursor effect is further added in step S103.
  • the method further includes:
  • the cursor map is displayed at the display position of the cursor map.
  • the cursor map is displayed in the typesetting direction of the text to be displayed.
  • the horizontal layout is from left to right, the cursor map is displayed on the right side of the text to be displayed; Lower typesetting, the cursor map is displayed on the lower side of the to-be-displayed text.
  • the display position of the cursor texture is (O[I cursor ].y) ].x+FontSize, O[I cursor ].y), that is, the display position of the cursor map is offset to the right by the size of FontSize from the display position of the text to be displayed, where FontSize is the text texture size of the text to be displayed .
  • the cursor map also needs to be scaled according to the size of the text texture, so that the height or width of the text texture is the same as that of the text texture. As shown in FIG. 7 , an example of a cursor map is shown. The height is h and the width is w. The cursor map is scaled according to the scaling ratio (FontSize/h) and then displayed at the display position of the cursor map.
  • the transparency of the cursor map can be adjusted periodically, for example, it is set to a cycle of 0.5 seconds, so that the transparency value of the cursor map is alternately 0 and 1, so that the cursor can be realized. flickering effect.
  • the text display method further includes step S104 , displaying the text to be displayed at the display position after a first time has elapsed.
  • the text to be displayed is displayed at the display position.
  • the step S104 includes: displaying the text texture of the to-be-displayed text at the display position after the first time elapses.
  • the display time of the text to be displayed is divided into n+1 time periods, wherein the first time is the first n time periods, the first n time periods display the dynamic text effect, and the last time period displays the dynamic text effect. Text to be displayed.
  • the text to be displayed is statically displayed on the screen until the text to be displayed or the termination time of the text to be displayed is reached.
  • the above-mentioned alternate text and the text to be displayed may be the same type of text, such as Chinese or English, so that when displaying the alternate display effect, the type of the text to be displayed is first judged, and then the type of the text to be displayed is selected. Texts of the same type are used as alternative texts to achieve the above-mentioned alternate display effect.
  • FIG. 7 is a schematic diagram of an application scenario of an embodiment of the present disclosure.
  • the application scenario also uses the text display method of the present disclosure to achieve a typing effect.
  • a sentence is displayed in the terminal with a typing effect.
  • the typing effect is that when the text to be displayed is displayed, the display time of the text to be displayed is divided into 4 segments, the first 3 segments display the text randomly, and the last 1 segment displays the text randomly. Display the text to be displayed in the segment to simulate the process of selecting text during typing. The text to be displayed that has been displayed will be displayed on the screen in a static form until the end time of the sentence is reached.
  • the displayed text "I am a primary school” is statically displayed on the screen, and the text to be displayed is "Student”; in the T1 period, it is in the display period of the dynamic text effect, and is randomly selected at this time
  • An alternate text "Set” is displayed in the display position of "Sheng", and the cursor is displayed on the right side of the display position of "Sheng”; similarly, the T2 and T3 periods are also in the display period of the dynamic text effect.
  • the characters “God” and "Saint” replace the alternate characters of the previous period to achieve the effect of alternately displaying alternate characters in the T1-T3 period; in the T4 period, the to-be-displayed character "sheng” is displayed, thus completing the typing of one character Effect.
  • Each text to be displayed in the whole sentence is displayed using the above method, so as to realize the dynamic display of the typing effect of the whole sentence.
  • the embodiment of the present disclosure discloses a text display method.
  • the text display method includes: acquiring text to be displayed; determining a display position of the text to be displayed on a screen according to a current time stamp; displaying a dynamic text effect at the display position; The text to be displayed is displayed at the position.
  • the display position of the text to be displayed is determined by the time stamp, and a dynamic text effect is displayed before the text to be displayed is displayed, so that the text display is more dynamic and flexible.
  • FIG. 8 is a schematic structural diagram of an embodiment of a text display device according to an embodiment of the present disclosure.
  • the device 800 includes: a text acquisition module 801 to be displayed, a display position determination module 802 and a text display module 803 . in,
  • a display position determination module 802 configured to determine the display position of the text to be displayed on the screen according to the current timestamp
  • a text display module 803 for displaying dynamic text effects at the display position
  • the to-be-displayed text is displayed at the display position after a first time has elapsed.
  • the display position determination module 802 is further configured to:
  • the text to be displayed includes at least one of the text to be displayed
  • the display position of the text to be displayed on the screen is determined according to the index of the cursor.
  • the display position determination module 802 is further configured to:
  • text display module 803 is also used for:
  • a plurality of alternate characters are randomly displayed at the display position; wherein each time period corresponds to one alternate character among the plurality of alternate characters.
  • text display module 803 is also used for:
  • n is a positive integer greater than 1;
  • n spare characters are randomly displayed at the display position; wherein, the n time periods correspond to the n spare characters one-to-one.
  • text display module 803 is also used for:
  • the text to be displayed includes at least one of the text to be displayed
  • the first number of alternate texts are alternately displayed at the display positions.
  • text display module 803 is also used for:
  • the display continues according to the first number, the current time stamp, the start time and a single text to be displayed time, the total number of to-be-displayed characters contained in the to-be-displayed text determines an integer; or,
  • the to-be-displayed text acquisition module 801 is also used for:
  • the text to be displayed includes at least one text to be displayed
  • At least one text to be displayed is split from the text to be displayed according to the first code of the text to be displayed.
  • text display device 800 is also used for:
  • a text texture for the alternate text is generated.
  • text display module 803 is also used for:
  • the text textures of the plurality of alternate texts are alternately displayed at the display position.
  • text display module 803 is also used for:
  • the text texture of the text to be displayed is displayed at the display position after the first time elapses.
  • the apparatus shown in FIG. 8 may execute the method of the embodiment shown in FIG. 1 to FIG. 6 .
  • the apparatus shown in FIG. 8 may execute the method of the embodiment shown in FIG. 1 to FIG. 6 .
  • FIG. 9 it shows a schematic structural diagram of an electronic device (eg, a terminal device or a server) 900 suitable for implementing an embodiment of the present disclosure.
  • Terminal devices in the embodiments of the present disclosure may include, but are not limited to, such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablets), PMPs (portable multimedia players), vehicle-mounted terminals (eg, Vehicle navigation terminals), mobile terminals such as wearable devices, etc., and stationary terminals such as digital TVs, desktop computers, smart home devices, and the like.
  • the electronic device shown in FIG. 9 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.
  • an electronic device 900 may include a processing device (eg, a central processing unit, a graphics processor, etc.) 901 that may be loaded into random access according to a program stored in a read only memory (ROM) 902 or from a storage device 908
  • the program in the memory (RAM) 903 executes various appropriate actions and processes, thereby realizing the text display method shown in the embodiment of the present disclosure.
  • various programs and data necessary for the operation of the electronic device 900 are also stored.
  • the processing device 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904.
  • An input/output (I/O) interface 905 is also connected to bus 904 .
  • the following devices can be connected to the I/O interface 905: input devices 906 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speakers, vibration An output device 907 such as a computer; a storage device 908 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 909 .
  • the communication means 909 may allow the electronic device 900 to communicate wirelessly or by wire with other devices to exchange data. While FIG. 9 shows an electronic device 900 having various means, it should be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the method shown in the flowcharts to implement as The text display method shown in the embodiment of the present disclosure.
  • the computer program may be downloaded and installed from the network via the communication device 909, or from the storage device 908, or from the ROM 902.
  • the processing apparatus 901 the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with computer-readable program code embodied thereon. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .
  • Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, electrical wire, optical fiber cable, RF (radio frequency), etc., or any suitable combination of the foregoing.
  • the client and server can communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and can communicate with digital data in any form or medium Communication (eg, a communication network) interconnects.
  • HTTP HyperText Transfer Protocol
  • Examples of communication networks include local area networks (“LAN”), wide area networks (“WAN”), the Internet (eg, the Internet), and peer-to-peer networks (eg, ad hoc peer-to-peer networks), as well as any currently known or future development network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or may exist alone without being assembled into the electronic device.
  • the computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device: executes the above-described text display method.
  • Computer program code for performing operations of the present disclosure may be written in one or more programming languages, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and This includes conventional procedural programming languages - such as the "C" language or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server.
  • the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through Internet connection).
  • LAN local area network
  • WAN wide area network
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions.
  • the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments of the present disclosure may be implemented in a software manner, and may also be implemented in a hardware manner. Among them, the name of the unit does not constitute a limitation of the unit itself under certain circumstances.
  • exemplary types of hardware logic components include: Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), Systems on Chips (SOCs), Complex Programmable Logical Devices (CPLDs) and more.
  • FPGAs Field Programmable Gate Arrays
  • ASICs Application Specific Integrated Circuits
  • ASSPs Application Specific Standard Products
  • SOCs Systems on Chips
  • CPLDs Complex Programmable Logical Devices
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with the instruction execution system, apparatus or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), fiber optics, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • a text display method including:
  • the to-be-displayed text is displayed at the display position after a first time has elapsed.
  • determining the display position of the text to be displayed on the screen according to the current timestamp includes:
  • the text to be displayed includes at least one of the text to be displayed
  • the display position of the text to be displayed on the screen is determined according to the index of the cursor.
  • determining the index of the cursor according to the current timestamp, the start time and the end time includes:
  • the displaying a dynamic text effect at the display position includes:
  • a plurality of alternate characters are randomly displayed at the display position; wherein each time period corresponds to one alternate character among the plurality of alternate characters.
  • displaying a plurality of spare characters at the display position including:
  • n is a positive integer greater than 1;
  • n spare characters are randomly displayed at the display position; wherein, the n time periods are in one-to-one correspondence with the n spare characters.
  • the displaying a dynamic text effect at the display position includes:
  • the text to be displayed includes at least one of the text to be displayed
  • the first number of alternate texts are alternately displayed at the display positions.
  • determining an integer according to the first quantity of alternate text, the current timestamp, the start time, and the end time including:
  • the display continues according to the first number, the current time stamp, the start time and a single text to be displayed time, the total number of to-be-displayed characters contained in the to-be-displayed text determines an integer; or,
  • the acquiring the text to be displayed includes:
  • the text to be displayed includes at least one text to be displayed
  • At least one text to be displayed is split from the text to be displayed according to the first code of the text to be displayed.
  • the method also includes:
  • a text texture for the alternate text is generated.
  • the displaying a dynamic text effect at the display position includes:
  • the text textures of the plurality of alternate texts are alternately displayed at the display position.
  • displaying the text to be displayed at the display position after the first time has elapsed including:
  • the text texture of the text to be displayed is displayed at the display position after the first time elapses.
  • a text display device comprising:
  • the text to be displayed acquisition module is used to acquire the text to be displayed
  • a display position determination module configured to determine the display position of the text to be displayed on the screen according to the current time stamp
  • a text display module for displaying dynamic text effects at the display position
  • the to-be-displayed text is displayed at the display position after a first time has elapsed.
  • the display position determination module is also used for:
  • the text to be displayed includes at least one of the text to be displayed
  • the display position of the text to be displayed on the screen is determined according to the index of the cursor.
  • the display position determination module is also used for:
  • text display module is also used for:
  • a plurality of alternate characters are randomly displayed at the display position; wherein each time period corresponds to one alternate character among the plurality of alternate characters.
  • text display module is also used for:
  • n is a positive integer greater than 1;
  • n spare characters are randomly displayed at the display position; wherein, the n time periods are in one-to-one correspondence with the n spare characters.
  • text display module is also used for:
  • the text to be displayed includes at least one of the text to be displayed
  • the first number of alternate texts are alternately displayed at the display positions.
  • text display module is also used for:
  • the display continues according to the first number, the current time stamp, the start time and a single text to be displayed time, the total number of to-be-displayed characters contained in the to-be-displayed text determines an integer; or,
  • the to-be-displayed text acquisition module is also used for:
  • the text to be displayed includes at least one text to be displayed
  • At least one text to be displayed is split from the text to be displayed according to the first code of the text to be displayed.
  • the text display device is also used for:
  • a text texture for the alternate text is generated.
  • text display module is also used for:
  • the text textures of the plurality of alternate texts are alternately displayed at the display position.
  • text display module is also used for:
  • the text texture of the text to be displayed is displayed at the display position after the first time elapses.
  • an electronic device comprising: at least one processor; and,
  • a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the at least one process
  • the computer can execute any of the aforementioned text display methods.
  • a non-transitory computer-readable storage medium stores computer instructions for causing a computer to execute the foregoing Any of the text display methods.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Controls And Circuits For Display Device (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

本公开实施例公开了一种文字显示方法、装置、电子设备和计算机可读存储介质。其中所述文字显示方法包括:获取待显示文字;根据当前时间戳确定所述待显示文字在屏幕中的显示位置;在所述显示位置处显示动态文字效果;以及经过第一时间之后在所述显示位置处显示所述待显示文字。本公开实施例通过时间戳确定待显示文字的显示位置并在显示所述待显示文字之前显示动态文字效果,使文字显示更加动态灵活。

Description

文字显示方法、装置、电子设备以及计算机可读存储介质
优先权信息
本申请要求于2020年10月23日提交中国专利局、申请号为202011143752.5、申请名称为“文字显示方法、装置、电子设备以及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本公开涉及文字显示技术领域,特别是涉及一种文字显示方法、装置、电子设备以及计算机可读存储介质。
背景技术
在视频中通常包含一些台词或歌词等文字信息,随着视频的播放这些文字信息也会被显示出来。目前的显示方式是,当视频播放到文字显示位置时,则直接显示对应的文字信息,这样看起来就显得比较呆板,不够灵活。
发明内容
提供该发明内容部分以便以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。该发明内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。
本公开解决的技术问题是提供一种文字显示方法,以至少部分地解决现有技术中直接显示文字信息,看起来就显得比较呆板,不够灵活的技术问题。此外,还提供一种文字显示装置、文字显示硬件装置、计算机可读存储介质和文字显示终端。
为了实现上述目的,根据本公开的一个方面,提供以下技术方案:
一种文字显示方法,包括:
获取待显示文字;
根据当前时间戳确定所述待显示文字在屏幕中的显示位置;
在所述显示位置处显示动态文字效果;以及
经过第一时间之后在所述显示位置处显示所述待显示文字。
为了实现上述目的,根据本公开的一个方面,提供以下技术方案:
一种文字显示装置,包括:
待显示文字获取模块,用于获取待显示文字;
显示位置确定模块,用于根据当前时间戳确定所述待显示文字在屏幕中的显示位置;
文字显示模块,用于在所述显示位置处显示动态文字效果;以及经过第一时间之后在所述显示位置处显示所述待显示文字。
为了实现上述目的,根据本公开的一个方面,提供以下技术方案:
一种电子设备,包括:
存储器,用于存储非暂时性计算机可读指令;以及
处理器,用于运行所述计算机可读指令,使得所述处理器执行时实现上述任一项所述的文字显示方法。
为了实现上述目的,根据本公开的一个方面,提供以下技术方案:
一种计算机可读存储介质,用于存储非暂时性计算机可读指令,当所述非暂时性计算机可读指令由计算机执行时,使得所述计算机执行上述任一项所述的文字显示方法。
为了实现上述目的,根据本公开的又一个方面,还提供以下技术方案:
一种文字显示终端,包括上述任一文字显示装置。
本公开实施例公开了一种文字显示方法、装置、电子设备和计算机可读存储介质。其中所述文字显示方法包括:获取待显示文字;根据当前时间戳确定所述待显示文字在屏幕中的显示位置;在所述显示位置处显示动态文字效果;以及经过第一时间之后在所述显示位置处显示所述待显示文字。本公开实施例通过时间戳确定待显示文字的显示位置并在显示所述待显示文字之前显示动态文字效果,使文字显示更加动态灵活。
上述说明仅是本公开技术方案的概述,为了能更清楚了解本公开的技术手段,而可依照说明书的内容予以实施,并且为让本公开的上述和其他目的、特征和优点能够更明显易懂,以下特举较佳实施例,并配合附图,详细说明如下。
附图说明
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。
图1为根据本公开一个实施例的文字显示方法的流程示意图;
图2为根据本公开一个实施例的文字显示方法的进一步的流程示意图;
图3为根据本公开一个实施例的文字显示方法的进一步的流程示意图;
图4为根据本公开一个实施例的文字显示方法的进一步的流程示意图;
图5为根据本公开一个实施例的文字显示方法的进一步的流程示意图;
图6为根据本公开一个实施例的文字显示方法的进一步的流程示意图;
图7为根据本公开一个实施例的文字显示方法的应用场景示意图;
图8为根据本公开一个实施例的文字显示装置的结构示意图;
图9为根据本公开一个实施例的电子设备的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,或并行执行。此外,方法实施方式可以包括附加的步骤或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。
图1为本公开实施例提供的文字显示方法实施例的流程图,本实施例提供的该文字显示方法可以由一文字显示装置来执行,该文字显示装置可以实现为软件,或者实现为软件和硬件的组合,该文字显示装置可以集成设置在文字显示系统中的某设备中,比如文字显示服务器或者文字显示终端设备中。如图1所示,该方法包括如下步骤:
步骤S101,获取待显示文字。
可选的,从待显示文本中获取待显示文字。所述待显示文本为文本文件, 所述文本文件中保存有至少一个待显示的文字,示例性的,所述文本文件包括歌词文件、字幕文件等。可选的,通过待显示文字的编码从所述待显示文本中拆分出不同的待显示文字,此时所述步骤S101包括:
获取待显示文本;其中所述待显示文本中包括至少一个待显示文字;
根据所述待显示文字的第一编码从所述待显示文本中拆分出至少一个待显示文字。
示例性的,所述待显示文字的第一编码为Unicode编码,不同的待显示文字对应不同的Unicode编码,由此可以通过Unicode编码将待显示文字从待显示文本中拆分出来。
可选的,所述待显示文字为从人机交互接口接收的至少一个待显示文字,如通过键盘、鼠标或触摸屏接收到的至少一个待显示文字。
可选的,在所述步骤S101之后,还包括:
生成所述待显示文字的文字纹理;
从文字库中选择多个备用文字,生成备用文字集;
生成所述备用文字的文字纹理。
可选的,所述文字纹理均被存储在纹理图集中,所述纹理图集中包括至少一个不重复的文字纹理。当获取到待显示文字之后,查询纹理图集中是否包含所述待显示文字的纹理,如果不包含,则生成所述待显示文字的文字纹理,将所述待显示文字的文字纹理存入所述纹理图集中,示例性的,所述文字纹理图集中还包括纹理索引表,用于标注文字和文字纹理的对应关系(例如,文字的标识和文字纹理的对应关系),当之后需要显示待显示文字时,可以通过文字的标识,如上述第一编码,查询文字纹理的存储位置,取出文字纹理并显示于显示屏上。所述备用文字用于在之后生成动态文字效果,备用文字可以与所述待显示文字相同或者不同,示例性的,所述备用文字是从文字库中随机选择出来的。备用文字的文字纹理的生成过程与所述待显示文字的文字纹理的生成过程相同,在此不再赘述。
可以理解的,上述获取待显示文字的方式仅为举例,不构成对本公开的限制。
步骤S102,根据当前时间戳确定所述待显示文字在屏幕中的显示位置。
可选的,确定待显示文字的显示位置之前,对所述待显示文字进行预排版。可选的,每个待显示文字包括一个显示原点,所述显示原点用于定位所述待显 示文字的显示位置,所述预排版为预先确定所述显示原点在屏幕中的位置。示例性的,按照横向格式排列所述待显示文字,当横向排列的待显示文字的文字行的长度超过预设的长度时,对所述待显示文字进行换行操作。记录所有待显示文字的显示原点在所述屏幕中的显示位置的序列,之后根据所需要的显示效果在所述屏幕中的对应显示位置上显示所述待显示文字。
可选的,所述步骤S102,包括:
步骤S201,确定待显示文本的起始时间和终止时间;所述待显示文本中包括至少一个所述待显示文字;
步骤S202,根据所述当前时间戳、所述起始时间和所述终止时间确定光标的索引;
步骤S203,根据所述光标的索引确定所述待显示文字在所述屏幕中的显示位置。
在该可选实施例中,要实现打字效果的文字显示效果,打字时需要在待显示的文字的位置显示光标。根据光标的索引确定光标的位置,光标的位置指示了待显示文字的位置。
在该可选实施例中,待显示文本具有显示的起始时间和终止时间,示例性的,该起始时间和终止时间通过时间参数计算,如所述待显示文本为一句歌词,所述时间参数为该句歌词起始时间的偏移量和终止时间的偏移量,则根据歌曲开始的时间戳可以计算出所述歌词的起始时间和终止时间。
在步骤S202中,为了得到打字效果的文字效果,需要通过当前时间戳计算出当前时间需要显示的待显示文字,即所述光标的索引,所述光标的索引即所述待显示文字在所述带显示文本中的索引,其表示所述待显示文字在所述待显示文本中的位置。
可选的,所述步骤S202包括:
步骤S301,当所述终止时间与所述起始时间的差值大于所述待显示文本的显示时间总和时,根据所述当前时间戳、所述起始时间和所述时间总和确定光标的索引;或,
步骤S302,当所述终止时间与所述起始时间的差值小于所述显示时间总和时,根据所述当前时间戳、所述起始时间、所述差值和提前显示完所有待显示文字的时间百分比确定光标的索引。
可选的,上述步骤S301和步骤S302通过以下公式(1)实现:
Figure PCTCN2021114373-appb-000001
其中公式(1)中的条件①对应步骤S301,条件②对应步骤S302。其中,charTime为待显示文字的显示时间,示例性的,所述带显示文字的显示时间是在打字效果中的每个待显示文字的打字效果的持续时间;charCount为待显示文本中的待显示文字的个数,duration=endTime–startTime,为上述终止时间与所述起始时间的差值,表示待显示文本的显示时长;timestamp表示当前时间戳,startTime表示待显示文本的开始时间,endTime表示待显示文本的终止时间。
在条件①中,duration>charTime*charCount,即终止时间与所述起始时间的差值大于所述待显示文本的显示时间总和,则
Figure PCTCN2021114373-appb-000002
Figure PCTCN2021114373-appb-000003
表示当前时间戳下待显示文字的光标的索引。示例性的,charTime=2秒,timestamp=8:00:05,startTime=8:00:00,则(timestamp-startTime)=5秒,则
Figure PCTCN2021114373-appb-000004
表示从开始时间起经过5秒时,显示索引为2的待显示文字。
在条件②中,duration<charTime*charCount,即终止时间与所述起始时间的差值小于所述显示时间总和,此时如果按照charTime显示每个待显示文字,则在待显示文本的显示时长内无法完成打字效果的显示,因此此时需要动态计算每个待显示文本的打字效果的持续时间;其中showPercent为控制参数,表示提前显示完所有待显示文字的时间百分比,用于控制显示完打字效果的整体时间,则
Figure PCTCN2021114373-appb-000005
即为每个待显示文字的打字效果的持续时间,由此可以得到
Figure PCTCN2021114373-appb-000006
示例性的,showPercent=0.8,duration=10秒,charCount=5,timestamp=8:00:05,startTime=8:00:00,则(timestamp-startTime)=5秒,则
Figure PCTCN2021114373-appb-000007
表示从开始时间起经过5秒时,显示索引为3的待显示文字。
可以理解的,上述获取光标的索引的方式仅为举例,不构成对本公开的限制。
回到图2中,步骤S203,在得到所述光标的索引之后,即可根据所述索引确定所述待显示文字的显示位置。如上述一个实施例中所示,所述显示位置为通过预排版确定的每个待显示文字的显示原点的显示位置,即每个待显示文字的显示位置是通过预排版确定好的,因此在通过所述光标的索引确定待显示文字之后,即可确定待显示文字在显示屏幕中的显示位置。
回到图1中,本公开实施例中的文字显示方法还包括:步骤S103,在所述显示位置处显示动态文字效果。
可选的,所述步骤S103包括:
在第一时间内的多个时间段内,在所述显示位置处随机显示多个备用文字;其中每个时间段对应所述多个备用文字中的一个备用文字。
其中所述备用文字是从文字库中随机选取的文字,所述备用文字可以与所述待显示文字的类型相同,也可以与所述待显示文字的类型不同。示例性的,所述待显示文字为中文文字,所述备用文字也是中文文字。可选的,在步骤S101之前或之后,还包括:从文字库中随机选取多个文字以生成备选文字库;生成所述多个备选文字的文字纹理。则在该步骤中,在第一时间内的多个时间段内的每个时间段开始时,随机从所述备选文字库中选择一个备选文字,获取所选择则的备选文字的文字纹理,将所述备选文字的文字纹理显示在所述显示位置处。
可选的,所述在第一时间内的多个时间段内,在所述显示位置处随机显示多个备用文字,包括:
步骤S401,将所述第一时间划分为n个时间段;其中,n为大于1的正整数;
步骤S402,在所述n个时间段内,在所述显示位置处随机显示n个备用文字;其中,所述n个时间段与所述n个备用文字一一对应。
在上述步骤中,所述n为预设的备用文字的个数,其表示在第一时间内需要显示的备用文字的个数。其中,所述n个时间段可以相等也可以不等,即所述第一时间可以均分为n个时间段或者不均分为n个时间段,在此不做限定。在所述n个时间段内,每个时间段对应一个备用文字,这样在连续经过所述n个时间段时,能够产生n个备用文字交替显示的效果。其中,在第一时间的长 度固定的情况下,n的取值越大,文字交替显示的速度越快。
可选的,所述步骤S103包括:
步骤S501,确定待显示文本的起始时间和终止时间;所述待显示文本中包括至少一个所述待显示文字;
步骤S502,根据备用文字的第一数量、所述当前时间戳、所述起始时间、所述终止时间确定一整数;
步骤S503,当所述整数小于所述第一数量时,将所述整数作为随机数种子;
步骤S504,根据所述随机数种子随机获取所述第一数量个备用文字;
步骤S505,在所述显示位置处交替显示所述第一数量个备用文字。
上述步骤S501-步骤S505描述了交替显示备用文字的实现过程。由于交替显示备用文字的过程需要在待显示文本的显示过程中实现,因此在步骤S501中获取待显示文本的起始时间和终止时间。
之后,在步骤S502中确定出一整数,该整数表示交替显示备用文字的时间段的索引。可选的,所述备用文字的第一数量为n,则将所述待显示文字的显示时间划分为(n+1)段,前n段用于交替显示所述n个备用文字,则在该步骤中的所述整数的取值范围为[0,n-1],分别对应所述n个备用文字。
可选的,所述步骤S502包括:
步骤S601,当所述终止时间与所述起始时间的差值大于待显示文本的显示时间总和时,根据所述第一数量、所述当前时间戳、所述起始时间和单个待显示文字的显示持续时间、所述待显示文本中包含的待显示文字的总数量确定一整数;或,
步骤S602,当所述终止时间与所述起始时间的差值小于所述显示时间总和时,根据所述第一数量、所述当前时间戳、所述起始时间、所述差值和提前显示完所述待显示文本中的所有待显示文字的时间百分比、所述待显示文本中包含的待显示文字的总数量确定一整数。
可选的,上述步骤S601和步骤S602可以由以下公式(2)实现:
Figure PCTCN2021114373-appb-000008
其中公式(2)中的条件①对应步骤S601,条件②对应步骤S602。其中,range为所述整数;charTime为待显示文字的显示时间,示例性的,所述带显示文字的显示时间是在打字效果中的每个待显示文字的打字效果的持续时 间;charCount为待显示文本中的待显示文字的个数,duration=endTime–startTime,为上述终止时间与所述起始时间的差值,表示待显示文本的显示时长;timestamp表示当前时间戳,startTime表示待显示文本的开始时间,endTime表示待显示文本的终止时间;n表示备选文字的第一数量。
在条件①中,duration>charTime*charCount,即终止时间与所述起始时间的差值大于所述待显示文本的显示时间总和,则:
Figure PCTCN2021114373-appb-000009
表示将待显示文字的显示时间charTime分为(n+1)个时间段,则当前时间戳timestamp所处的时间段在所述(n+1)个时间段中的索引。
示例性的,charTime=2秒,n=3,(timestamp-startTime)=2.3秒,则:
Figure PCTCN2021114373-appb-000010
表示从开始时间起经过2.3秒时,当前时间戳位于待显示文字的显示时间的4个时间段中的第0个时间段。
示例性的,charTime=2秒,n=3,(timestamp-startTime)=2.6秒,则:
Figure PCTCN2021114373-appb-000011
表示从开始时间起经过2.6秒时,当前时间戳位于待显示文字的显示时间的4个时间段中的第1个时间段。
在上述条件②中,duration<charTime*charCount,即终止时间与所述起始时间的差值小于所述显示时间总和,此时如果按照charTime显示每个待显示文字,则在待显示文本的显示时长内无法完成打字效果的显示,因此此时需要动态计算每个待显示文本的打字效果的持续时间;其中showPercent为控制参数,表示提前显示完所有待显示文字的时间百分比,用于控制显示完打字效果的整体时间,则
Figure PCTCN2021114373-appb-000012
即为每个待显示文字的打字效果的持续时间,由此可以得到:
Figure PCTCN2021114373-appb-000013
示例性的,showPercent=0.8,n=3,duration=10秒,(timestamp-startTime)=2.3秒,charCount=5,则:
Figure PCTCN2021114373-appb-000014
表示从开始时间起经过2.3秒时,当前时间戳位于待显示文字的显示时间的4个时间段中的第1个时间段。
示例性的,showPercent=0.8,n=3,duration=10秒,(timestamp-startTime)=2.6秒,charCount=5,则:
Figure PCTCN2021114373-appb-000015
表示从开始时间起经过2.6秒时,当前时间戳位于待显示文字的显示时间的4个时间段中的第2个时间段。
返回图5,在确定了整数之后,在步骤S503中,判断所述整数是否小于所述第一数量,即上述range是否小于n,当range<n时,将range作为随机数种子,并在步骤S504中使用所述随机数种子中随机选取出一个备用文字,作为当前要显示的备选文字,之后在步骤S505中,将所述备用文字显示于所述显示位置处,由于range的取值在0到(n-1)之间变化,因此产生备用文字交替显示的效果。
可选的,在预先生成备用文字集和文字纹理的情况下,所述步骤S103包括:
从所述备用文字集中随机选择多个备用文字;
在第一时间内,在所述显示位置处交替显示所述多个备用文字的文字纹理。
具体的交替显示的实现可以与上述实施例中的相同,在此不再赘述。
可选的,为了更加逼真的实现打字效果,在步骤S103中还进一步加入光标效果。可选的,所述方法还包括:
获取光标贴图;
根据所述待显示文字的显示位置确定所述光标贴图的显示位置;
在所述光标贴图的显示位置显示所述光标贴图。
可选的,所述光标贴图显示于所述待显示文字的排版方向上,如横向从左到右排版,则所述光标贴图显示于所述待显示文字的右侧;如竖向从上到下排版,则所述光标贴图显示于所述待显示文字的下侧。以横向从左到右排版为例,设待显示文字的显示位置为(O[I cursor].x,O[I cursor].y),则所述光标贴图的显示位置为(O[I cursor].x+FontSize,O[I cursor].y),即所述光标贴图的显示位置比所述待显示文字的显示位置向右偏移FontSize的大小,其中FontSize为待 显示文字的文字纹理大小。进一步的,为了效果更加逼真,还需要根据文字纹理的大小对所述光标贴图进行缩放,使其与文字纹理的高度或者宽度相同。如图7所示为光标贴图的示例,其高度为h,宽度为w,则根据缩放比例(FontSize/h)来对光标贴图进行缩放之后再显示于所述光标贴图的显示位置。
可选的,为了打字效果更加逼真,可以对所述光标贴图的透明度进行周期性调节,如设置成以0.5秒为周期,使所述光标贴图的透明度值交替为0和1,这样可以实现光标闪烁的效果。
可以理解的,上述交替显示的动态文字效果仅为动态文字效果的举例,不构成对本公开的限制,实际上任何其他动态文字效果均可以应用于本公开中,在此不再赘述。
返回图1,本公开实施例所述的文字显示方法,还包括步骤S104,经过第一时间之后在所述显示位置处显示所述待显示文字。
在显示完所述动态文字效果之后,在所述显示位置处显示待显示文字。可选的,所述步骤S104包括:经过第一时间之后在所述显示位置处显示所述待显示文字的文字纹理。如上述实施例中所示,将待显示文字的显示时间划分为n+1个时段,其中第一时间即为前n个时段,前n个时段显示所述动态文字效果,在最后一个时段显示待显示文字。
可以理解的,在显示了所述待显示文字之后,所述待显示文字即静态显示于屏幕中,直到达到所述待显示文本或待显示文字的终止时间。
可选的,上述备用文字与所述待显示文字可以是同类型的文字,如中文或英文,这样在显示所述交替显示效果时,首先判断所述待显示文字的类型,之后选择与所述类型相同的文字作为备选文字来实现上述交替显示效果。
如图7为本公开实施例的一个应用场景示意图。还应用场景使用本公开的文字显示方法实现了打字效果。如图7所示,在终端中以打字效果显示一句话,所述打字效果为在显示待显示文字时,将待显示文字的显示时间分为4段,前3段随机显示文字,在最后1段显示待显示文字以模拟打字中选择文字的过程,已经显示的待显示文字,会以静态的形式一直显示于屏幕中,直至到达这句话的终止时间。如图7所示,已经显示的待显示文字“我是一名小学”静态显示于屏幕中,待显示文字为“生”;在T1时段中,处于动态文字效果的显示时段,此时随机选择一个备用文字“设”,显示于“生”的显示位置,并在“生”的显示位置右侧显示光标;同样的,T2和T3时段,也处于动态文字效果的显 示时段,分别用随机备用文字“神”和“圣”替换前一时段的备用文字,以在T1-T3时段实现备用文字交替显示的效果;在T4时段,显示待显示文字“生”,由此完成了一个字的打字效果。整句话的每一个待显示文字都使用上述方法进行显示,以实现整句话的打字效果的动态显示。
本公开实施例公开了一种文字显示方法。所述文字显示方法包括:获取待显示文字;根据当前时间戳确定所述待显示文字在屏幕中的显示位置;在所述显示位置处显示动态文字效果;以及经过第一时间之后在所述显示位置处显示所述待显示文字。本公开实施例通过时间戳确定待显示文字的显示位置并在显示所述待显示文字之前显示动态文字效果,使文字显示更加动态灵活。
在上文中,虽然按照上述的顺序描述了上述方法实施例中的各个步骤,本领域技术人员应清楚,本公开实施例中的步骤并不必然按照上述顺序执行,其也可以倒序、并行、交叉等其他顺序执行,而且,在上述步骤的基础上,本领域技术人员也可以再加入其他步骤,这些明显变型或等同替换的方式也应包含在本公开的保护范围之内,在此不再赘述。
图8为本公开实施例提供的文字显示装置实施例的结构示意图,如图8所示,该装置800包括:待显示文字获取模块801、显示位置确定模块802和文字显示模块803。其中,
待显示文字获取模块801,用于获取待显示文字;
显示位置确定模块802,用于根据当前时间戳确定所述待显示文字在屏幕中的显示位置;
文字显示模块803,用于在所述显示位置处显示动态文字效果;以及
经过第一时间之后在所述显示位置处显示所述待显示文字。
进一步的,所述显示位置确定模块802,还用于:
确定待显示文本的起始时间和终止时间;所述待显示文本中包括至少一个所述待显示文字;
根据所述当前时间戳、所述起始时间和所述终止时间确定光标的索引;
根据所述光标的索引确定所述待显示文字在所述屏幕中的显示位置。
进一步的,所述显示位置确定模块802,还用于:
当所述终止时间与所述起始时间的差值大于所述待显示文本的显示时间总和时,根据所述当前时间戳、所述起始时间和所述时间总和确定光标的索引;
或,当所述终止时间与所述起始时间的差值小于所述显示时间总和时,根 据所述当前时间戳、所述起始时间、所述差值和提前显示完所有待显示文字的时间百分比确定光标的索引。
进一步的,所述文字显示模块803,还用于:
在第一时间内的多个时间段内,在所述显示位置处随机显示多个备用文字;其中每个时间段对应所述多个备用文字中的一个备用文字。
进一步的,所述文字显示模块803,还用于:
将所述第一时间划分为n个时间段;其中,n为大于1的正整数;
在所述n个时间段内,在所述显示位置处随机显示n个备用文字;其中,所述n个时间段与所述n个备用文字一一对应。
进一步的,所述文字显示模块803,还用于:
确定待显示文本的起始时间和终止时间;所述待显示文本中包括至少一个所述待显示文字;
根据备用文字的第一数量、所述当前时间戳、所述起始时间、所述终止时间确定一整数;
当所述整数小于所述第一数量时,将所述整数作为随机数种子;
根据所述随机数种子随机获取所述第一数量个备用文字;
在所述显示位置处交替显示所述第一数量个备用文字。
进一步的,所述文字显示模块803,还用于:
当所述终止时间与所述起始时间的差值大于待显示文本的显示时间总和时,根据所述第一数量、所述当前时间戳、所述起始时间和单个待显示文字的显示持续时间、所述待显示文本中包含的待显示文字的总数量确定一整数;或,
当所述终止时间与所述起始时间的差值小于所述显示时间总和时,根据所述第一数量、所述当前时间戳、所述起始时间、所述差值和提前显示完所述待显示文本中的所有待显示文字的时间百分比、所述待显示文本中包含的待显示文字的总数量确定一整数。
进一步的,所述待显示文字获取模块801,还用于:
获取待显示文本;其中所述待显示文本中包括至少一个待显示文字;
根据所述待显示文字的第一编码从所述待显示文本中拆分出至少一个待显示文字。
进一步的,所述文字显示装置800,还用于:
生成所述待显示文字的文字纹理;
从文字库中选择多个备用文字,生成备用文字集;
生成所述备用文字的文字纹理。
进一步的,所述文字显示模块803,还用于:
从所述备用文字集中随机选择多个备用文字;
在第一时间内,在所述显示位置处交替显示所述多个备用文字的文字纹理。
进一步的,所述文字显示模块803,还用于:
经过第一时间之后在所述显示位置处显示所述待显示文字的文字纹理。
图8所示装置可以执行图1-图6所示实施例的方法,本实施例未详细描述的部分,可参考对图1-图6所示实施例的相关说明。该技术方案的执行过程和技术效果参见图1-图6所示实施例中的描述,在此不再赘述。
下面参考图9,其示出了适于用来实现本公开实施例的电子设备(例如终端设备或服务器)900的结构示意图。本公开实施例中的终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)、可穿戴设备等等的移动终端以及诸如数字TV、台式计算机、智能家居设备等等的固定终端。图9示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图9所示,电子设备900可以包括处理装置(例如中央处理器、图形处理器等)901,其可以根据存储在只读存储器(ROM)902中的程序或者从存储装置908加载到随机访问存储器(RAM)903中的程序而执行各种适当的动作和处理,从而实现如本公开实施例所示的文字显示方法。在RAM 903中,还存储有电子设备900操作所需的各种程序和数据。处理装置901、ROM 902以及RAM 903通过总线904彼此相连。输入/输出(I/O)接口905也连接至总线904。
通常,以下装置可以连接至I/O接口905:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置906;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置907;包括例如磁带、硬盘等的存储装置908;以及通信装置909。通信装置909可以允许电子设备900与其他设备进行无线或有线通信以交换数据。虽然图9示出了具有各种装置的电子设备900,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码,以实现如本公开实施例所示的文字显示方法。在这样的实施例中,该计算机程序可以通过通信装置909从网络上被下载和安装,或者从存储装置908被安装,或者从ROM 902被安装。在该计算机程序被处理装置901执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在, 而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:执行上述文字显示方法。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地 使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的一个或多个实施例,提供了一种文字显示方法,包括:
获取待显示文字;
根据当前时间戳确定所述待显示文字在屏幕中的显示位置;
在所述显示位置处显示动态文字效果;以及
经过第一时间之后在所述显示位置处显示所述待显示文字。
进一步的,所述根据当前时间戳确定所述待显示文字在屏幕中的显示位置,包括:
确定待显示文本的起始时间和终止时间;所述待显示文本中包括至少一个所述待显示文字;
根据所述当前时间戳、所述起始时间和所述终止时间确定光标的索引;
根据所述光标的索引确定所述待显示文字在所述屏幕中的显示位置。
进一步的,所述根据所述当前时间戳、所述起始时间和所述终止时间确定光标的索引,包括:
当所述终止时间与所述起始时间的差值大于所述待显示文本的显示时间总和时,根据所述当前时间戳、所述起始时间和所述时间总和确定光标的索引;
或,当所述终止时间与所述起始时间的差值小于所述显示时间总和时,根据所述当前时间戳、所述起始时间、所述差值和提前显示完所有待显示文字的时间百分比确定光标的索引。
进一步的,所述在所述显示位置处显示动态文字效果,包括:
在第一时间内的多个时间段内,在所述显示位置处随机显示多个备用文字;其中每个时间段对应所述多个备用文字中的一个备用文字。
进一步的,所述在所述第一时间内的多个时间段内,在所述显示位置处显示多个备用文字,包括:
将所述第一时间划分为n个时间段;其中,n为大于1的正整数;
在所述n个时间段内,在所述显示位置处随机显示n个备用文字;其中,所述n个时间段与所述n个备用文字一一对应。
进一步的,所述在所述显示位置处显示动态文字效果,包括:
确定待显示文本的起始时间和终止时间;所述待显示文本中包括至少一个所述待显示文字;
根据备用文字的第一数量、所述当前时间戳、所述起始时间、所述终止时间确定一整数;
当所述整数小于所述第一数量时,将所述整数作为随机数种子;
根据所述随机数种子随机获取所述第一数量个备用文字;
在所述显示位置处交替显示所述第一数量个备用文字。
进一步的,所述根据备用文字的第一数量、所述当前时间戳、所述起始时间、所述终止时间确定一整数,包括:
当所述终止时间与所述起始时间的差值大于待显示文本的显示时间总和时,根据所述第一数量、所述当前时间戳、所述起始时间和单个待显示文字的显示持续时间、所述待显示文本中包含的待显示文字的总数量确定一整数;或,
当所述终止时间与所述起始时间的差值小于所述显示时间总和时,根据所述第一数量、所述当前时间戳、所述起始时间、所述差值和提前显示完所述待显示文本中的所有待显示文字的时间百分比、所述待显示文本中包含的待显示文字的总数量确定一整数。
进一步的,所述获取待显示文字,包括:
获取待显示文本;其中所述待显示文本中包括至少一个待显示文字;
根据所述待显示文字的第一编码从所述待显示文本中拆分出至少一个待显示文字。
进一步的,所述方法还包括:
生成所述待显示文字的文字纹理;
从文字库中选择多个备用文字,生成备用文字集;
生成所述备用文字的文字纹理。
进一步的,所述在所述显示位置处显示动态文字效果,包括:
从所述备用文字集中随机选择多个备用文字;
在第一时间内,在所述显示位置处交替显示所述多个备用文字的文字纹理。
进一步的,所述经过第一时间之后在所述显示位置处显示所述待显示文字, 包括:
经过第一时间之后在所述显示位置处显示所述待显示文字的文字纹理。
根据本公开的一个或多个实施例,提供了一种文字显示装置,包括:
待显示文字获取模块,用于获取待显示文字;
显示位置确定模块,用于根据当前时间戳确定所述待显示文字在屏幕中的显示位置;
文字显示模块,用于在所述显示位置处显示动态文字效果;以及
经过第一时间之后在所述显示位置处显示所述待显示文字。
进一步的,所述显示位置确定模块,还用于:
确定待显示文本的起始时间和终止时间;所述待显示文本中包括至少一个所述待显示文字;
根据所述当前时间戳、所述起始时间和所述终止时间确定光标的索引;
根据所述光标的索引确定所述待显示文字在所述屏幕中的显示位置。
进一步的,所述显示位置确定模块,还用于:
当所述终止时间与所述起始时间的差值大于所述待显示文本的显示时间总和时,根据所述当前时间戳、所述起始时间和所述时间总和确定光标的索引;
或,当所述终止时间与所述起始时间的差值小于所述显示时间总和时,根据所述当前时间戳、所述起始时间、所述差值和提前显示完所有待显示文字的时间百分比确定光标的索引。
进一步的,所述文字显示模块,还用于:
在第一时间内的多个时间段内,在所述显示位置处随机显示多个备用文字;其中每个时间段对应所述多个备用文字中的一个备用文字。
进一步的,所述文字显示模块,还用于:
将所述第一时间划分为n个时间段;其中,n为大于1的正整数;
在所述n个时间段内,在所述显示位置处随机显示n个备用文字;其中,所述n个时间段与所述n个备用文字一一对应。
进一步的,所述文字显示模块,还用于:
确定待显示文本的起始时间和终止时间;所述待显示文本中包括至少一个所述待显示文字;
根据备用文字的第一数量、所述当前时间戳、所述起始时间、所述终止时间确定一整数;
当所述整数小于所述第一数量时,将所述整数作为随机数种子;
根据所述随机数种子随机获取所述第一数量个备用文字;
在所述显示位置处交替显示所述第一数量个备用文字。
进一步的,所述文字显示模块,还用于:
当所述终止时间与所述起始时间的差值大于待显示文本的显示时间总和时,根据所述第一数量、所述当前时间戳、所述起始时间和单个待显示文字的显示持续时间、所述待显示文本中包含的待显示文字的总数量确定一整数;或,
当所述终止时间与所述起始时间的差值小于所述显示时间总和时,根据所述第一数量、所述当前时间戳、所述起始时间、所述差值和提前显示完所述待显示文本中的所有待显示文字的时间百分比、所述待显示文本中包含的待显示文字的总数量确定一整数。
进一步的,所述待显示文字获取模块,还用于:
获取待显示文本;其中所述待显示文本中包括至少一个待显示文字;
根据所述待显示文字的第一编码从所述待显示文本中拆分出至少一个待显示文字。
进一步的,所述文字显示装置,还用于:
生成所述待显示文字的文字纹理;
从文字库中选择多个备用文字,生成备用文字集;
生成所述备用文字的文字纹理。
进一步的,所述文字显示模块,还用于:
从所述备用文字集中随机选择多个备用文字;
在第一时间内,在所述显示位置处交替显示所述多个备用文字的文字纹理。
进一步的,所述文字显示模块,还用于:
经过第一时间之后在所述显示位置处显示所述待显示文字的文字纹理。
根据本公开的一个或多个实施例,提供了一种电子设备,包括:至少一个处理器;以及,
与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有能被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行前述任一所述文字显示方法。
根据本公开的一个或多个实施例,提供了一种非暂态计算机可读存储介质,其特征在于,该非暂态计算机可读存储介质存储计算机指令,该计算机指令用 于使计算机执行前述任一所述文字显示方法。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。

Claims (14)

  1. 一种文字显示方法,其特征在于,包括:
    获取待显示文字;
    根据当前时间戳确定所述待显示文字在屏幕中的显示位置;
    在所述显示位置处显示动态文字效果;以及
    经过第一时间之后在所述显示位置处显示所述待显示文字。
  2. 根据权利要求1所述的方法,其特征在于,所述根据当前时间戳确定所述待显示文字在屏幕中的显示位置,包括:
    确定待显示文本的起始时间和终止时间;所述待显示文本中包括至少一个所述待显示文字;
    根据所述当前时间戳、所述起始时间和所述终止时间确定光标的索引;
    根据所述光标的索引确定所述待显示文字在所述屏幕中的显示位置。
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述当前时间戳、所述起始时间和所述终止时间确定光标的索引,包括:
    当所述终止时间与所述起始时间的差值大于所述待显示文本的显示时间总和时,根据所述当前时间戳、所述起始时间和所述时间总和确定光标的索引;
    或,当所述终止时间与所述起始时间的差值小于所述显示时间总和时,根据所述当前时间戳、所述起始时间、所述差值和提前显示完所有待显示文字的时间百分比确定光标的索引。
  4. 根据权利要求1所述的方法,其特征在于,所述在所述显示位置处显示动态文字效果,包括:
    在第一时间内的多个时间段内,在所述显示位置处随机显示多个备用文字;其中每个时间段对应所述多个备用文字中的一个备用文字。
  5. 根据权利要求4所述的方法,其特征在于,所述在所述第一时间内的多个时间段内,在所述显示位置处显示多个备用文字,包括:
    将所述第一时间划分为n个时间段;其中,n为大于1的正整数;
    在所述n个时间段内,在所述显示位置处随机显示n个备用文字;其中,所述n个时间段与所述n个备用文字一一对应。
  6. 根据权利要求1所述的方法,其特征在于,所述在所述显示位置处显示动态文字效果,包括:
    确定待显示文本的起始时间和终止时间;所述待显示文本中包括至少一个 所述待显示文字;
    根据备用文字的第一数量、所述当前时间戳、所述起始时间、所述终止时间确定一整数;
    当所述整数小于所述第一数量时,将所述整数作为随机数种子;
    根据所述随机数种子随机获取所述第一数量个备用文字;
    在所述显示位置处交替显示所述第一数量个备用文字。
  7. 根据权利要求6所述的方法,其特征在于,所述根据备用文字的第一数量、所述当前时间戳、所述起始时间、所述终止时间确定一整数,包括:
    当所述终止时间与所述起始时间的差值大于待显示文本的显示时间总和时,根据所述第一数量、所述当前时间戳、所述起始时间和单个待显示文字的显示持续时间、所述待显示文本中包含的待显示文字的总数量确定一整数;或,
    当所述终止时间与所述起始时间的差值小于所述显示时间总和时,根据所述第一数量、所述当前时间戳、所述起始时间、所述差值和提前显示完所述待显示文本中的所有待显示文字的时间百分比、所述待显示文本中包含的待显示文字的总数量确定一整数。
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述获取待显示文字,包括:
    获取待显示文本;其中所述待显示文本中包括至少一个待显示文字;
    根据所述待显示文字的第一编码从所述待显示文本中拆分出至少一个待显示文字。
  9. 根据权利要求8所述的方法,其特征在于,所述方法还包括:
    生成所述待显示文字的文字纹理;
    从文字库中选择多个备用文字,生成备用文字集;
    生成所述备用文字的文字纹理。
  10. 如权利要求9所述的方法,其特征在于,所述在所述显示位置处显示动态文字效果,包括:
    从所述备用文字集中随机选择多个备用文字;
    在第一时间内,在所述显示位置处交替显示所述多个备用文字的文字纹理。
  11. 如权利要求9所述的方法,其特征在于,所述经过第一时间之后在所述显示位置处显示所述待显示文字,包括:
    经过第一时间之后在所述显示位置处显示所述待显示文字的文字纹理。
  12. 一种文字显示装置,其特征在于,包括:
    待显示文字获取模块,用于获取待显示文字;
    显示位置确定模块,用于根据当前时间戳确定所述待显示文字在屏幕中的显示位置;
    文字显示模块,用于在所述显示位置处显示动态文字效果;以及经过第一时间之后在所述显示位置处显示所述待显示文字。
  13. 一种电子设备,包括:
    存储器,用于存储非暂时性计算机可读指令;以及
    处理器,用于运行所述计算机可读指令,使得所述处理器执行时实现根据权利要求1-12任一项所述的文字显示方法。
  14. 一种计算机可读存储介质,用于存储非暂时性计算机可读指令,当所述非暂时性计算机可读指令由计算机执行时,使得所述计算机执行权利要求1-12任一项所述的文字显示方法。
PCT/CN2021/114373 2020-10-23 2021-08-24 文字显示方法、装置、电子设备以及计算机可读存储介质 WO2022083273A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/245,112 US20230351651A1 (en) 2020-10-23 2021-08-24 Character display method and apparatus, electronic device, and computer-readable storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011143752.5 2020-10-23
CN202011143752.5A CN112256176B (zh) 2020-10-23 2020-10-23 文字显示方法、装置、电子设备以及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2022083273A1 true WO2022083273A1 (zh) 2022-04-28

Family

ID=74263438

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/114373 WO2022083273A1 (zh) 2020-10-23 2021-08-24 文字显示方法、装置、电子设备以及计算机可读存储介质

Country Status (3)

Country Link
US (1) US20230351651A1 (zh)
CN (1) CN112256176B (zh)
WO (1) WO2022083273A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256176B (zh) * 2020-10-23 2022-04-05 北京字节跳动网络技术有限公司 文字显示方法、装置、电子设备以及计算机可读存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101567184A (zh) * 2009-03-24 2009-10-28 广州酷狗计算机科技有限公司 一种卡拉ok动感歌词的制作方法
CN102148048A (zh) * 2011-05-12 2011-08-10 北京瑞信在线系统技术有限公司 歌词显示方法及装置
CN107944397A (zh) * 2017-11-27 2018-04-20 腾讯音乐娱乐科技(深圳)有限公司 视频录制方法、装置及计算机可读存储介质
CN107943964A (zh) * 2017-11-27 2018-04-20 腾讯音乐娱乐科技(深圳)有限公司 歌词显示方法、装置及计算机可读存储介质
CN109257499A (zh) * 2018-09-30 2019-01-22 腾讯音乐娱乐科技(深圳)有限公司 一种歌词的动态展示方法及装置
CN112256176A (zh) * 2020-10-23 2021-01-22 北京字节跳动网络技术有限公司 文字显示方法、装置、电子设备以及计算机可读存储介质

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102109054B1 (ko) * 2013-04-26 2020-05-28 삼성전자주식회사 애니메이션 효과를 제공하는 사용자 단말 장치 및 그 디스플레이 방법
CN103593338B (zh) * 2013-11-15 2016-05-11 北京锐安科技有限公司 一种信息处理方法及装置
CN105279140B (zh) * 2014-07-22 2020-09-04 腾讯科技(深圳)有限公司 文本显示方法、服务器、终端及系统
CN107257507A (zh) * 2017-07-05 2017-10-17 武汉斗鱼网络科技有限公司 弹幕显示方法、装置及电子设备
CN108419113B (zh) * 2018-05-24 2021-01-08 广州酷狗计算机科技有限公司 字幕显示方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101567184A (zh) * 2009-03-24 2009-10-28 广州酷狗计算机科技有限公司 一种卡拉ok动感歌词的制作方法
CN102148048A (zh) * 2011-05-12 2011-08-10 北京瑞信在线系统技术有限公司 歌词显示方法及装置
CN107944397A (zh) * 2017-11-27 2018-04-20 腾讯音乐娱乐科技(深圳)有限公司 视频录制方法、装置及计算机可读存储介质
CN107943964A (zh) * 2017-11-27 2018-04-20 腾讯音乐娱乐科技(深圳)有限公司 歌词显示方法、装置及计算机可读存储介质
CN109257499A (zh) * 2018-09-30 2019-01-22 腾讯音乐娱乐科技(深圳)有限公司 一种歌词的动态展示方法及装置
CN112256176A (zh) * 2020-10-23 2021-01-22 北京字节跳动网络技术有限公司 文字显示方法、装置、电子设备以及计算机可读存储介质

Also Published As

Publication number Publication date
US20230351651A1 (en) 2023-11-02
CN112256176A (zh) 2021-01-22
CN112256176B (zh) 2022-04-05

Similar Documents

Publication Publication Date Title
WO2020233444A1 (zh) 在线文档插入信息方法及装置
WO2022057348A1 (zh) 音乐海报生成方法、装置、电子设备及介质
WO2022083250A1 (zh) 图像处理方法、装置、电子设备和计算机可读存储介质
EP4124052A1 (en) Video production method and apparatus, and device and storage medium
EP4131932A1 (en) Video effect configuration file generation method, and video rendering method and device
WO2022083239A1 (zh) 文字显示方法、装置、电子设备及计算机可读存储介质
CN111596995B (zh) 展示方法、装置和电子设备
WO2022083273A1 (zh) 文字显示方法、装置、电子设备以及计算机可读存储介质
CN116302289A (zh) 一种显示交互方法、装置及设备
CN113238688B (zh) 表格展示方法、装置、设备及介质
CN111338827B (zh) 表格数据的粘贴方法、装置以及电子设备
WO2022222679A1 (zh) 交互方法、装置、电子设备及非易失性计算机可读存储介质
CN114327732B (zh) 页面配置方法、装置、电子设备和计算机可读介质
WO2022242441A1 (zh) 电子表格导入方法、装置、设备及介质
WO2022083240A1 (zh) 文字显示方法、装置、电子设备及计算机可读存储介质
WO2022095932A1 (zh) 直播间页面跳转方法、返回方法、装置及电子设备
WO2022184037A1 (zh) 文档处理方法、装置、设备和介质
CN111626045A (zh) 字符长度计算方法、装置及电子设备
CN110780898A (zh) 页面数据的升级方法、装置和电子设备
US12020347B2 (en) Method and apparatus for text effect processing
CN111783390B (zh) 维度标签的调整方法、装置以及电子设备
CN112906371B (zh) 一种平行语料获取方法、装置、设备及存储介质
CN114356311B (zh) 代码性能数据的交互方法、装置、介质及电子设备
CN111859879B (zh) 基于虚拟表格的数据展示方法、装置以及电子设备
WO2021018176A1 (zh) 文字特效处理方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21881692

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 03.08.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21881692

Country of ref document: EP

Kind code of ref document: A1