Subtitle display method and device, electronic equipment and computer readable storage medium
By generating an index table, the storage path of the target characters of the target font is solved, and the problem of slow subtitle display in the prior art is solved, and more efficient subtitle display is achieved.
Patent Information
- Application Number
- CN202510113773.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-05-23
AI Technical Summary
When displaying text subtitles in the prior art, it is necessary to open each font file in the font library in sequence to match the characters of the corresponding font, which results in a long time and affects the display speed of the subtitles.
By generating an index table, the storage path of the target characters of the target font can be quickly obtained, thereby directly obtaining the target characters of the target font and reducing the search time.
It greatly shortens the time to obtain target characters in the target font, speeds up the display speed of subtitles, and improves the display efficiency of subtitles.
Smart Images

Figure CN120034697A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a subtitle display method, device, electronic device, and computer-readable storage medium. Background Art
[0002] The player can display text subtitles. The characters in different text subtitles may have different fonts. You need to find the characters of the corresponding font to display the text subtitles normally. The multiple font files in the font set contain various characters of various fonts. In order to find the characters of the corresponding font to display the text subtitles normally, the related technology needs to open each font file in the font library in turn to match the characters of the corresponding font, which takes a long time and affects the display speed of the entire text subtitles. Summary of the invention
[0003] The embodiments of the present application provide a subtitle display method, device, electronic device and computer-readable storage medium, which can quickly obtain target characters of a target font based on an index table, thereby accelerating the display speed of subtitles.
[0004] In a first aspect, an embodiment of the present application provides a subtitle display method, comprising:
[0005] Determining a target font for target characters corresponding to subtitles to be displayed;
[0006] Searching the target font corresponding to the target character in an index table, wherein the index table includes: a plurality of characters, a plurality of fonts corresponding to the plurality of characters, and storage paths of the plurality of characters in each font;
[0007] When the target font corresponding to the target character is found in the index table, a target storage path of the target character in the target font is obtained;
[0008] According to the target storage path, obtaining the target characters of the target font;
[0009] The subtitles are displayed according to the target characters of the target font.
[0010] In one embodiment, before searching the index table for the target font corresponding to the target character, the method further includes:
[0011] Get the font set;
[0012] Traversing each font file in the font set to obtain each character of each font;
[0013] According to the characters of the fonts, determining the fonts corresponding to the characters;
[0014] Determining the storage path of each character of each font according to the storage path of each character in each font file;
[0015] The index table is generated according to each of the characters, each of the fonts corresponding to the characters, and a storage path of each of the characters in each of the fonts.
[0016] In one embodiment, after searching the index table for the target font corresponding to the target character, the method further includes:
[0017] When the target font corresponding to the target character cannot be found in the index table, obtaining a font set;
[0018] Searching for the target character of the target font in each font file in the font set;
[0019] When the target character of the target font is found in each font file in the font set, the target character of the target font is acquired;
[0020] The subtitles are displayed according to the target characters of the target font.
[0021] In one of the embodiments, after searching each character library file in the character library set for the target character of the target font, the method further comprises:
[0022] When the target character of the target font is found in each font file in the font set, deleting the index table;
[0023] Generate a new index table.
[0024] In one of the embodiments, after searching each character library file in the character library set for the target character of the target font, the method further comprises:
[0025] When the target character of the target font cannot be found in each font file in the font set, determining the target character of the target font as a reference character;
[0026] The subtitles are displayed according to the reference characters.
[0027] In one embodiment, querying the target font corresponding to the target character in the index table includes:
[0028] Searching the target character in the index table;
[0029] When the target character is found in the index table, it is queried whether each font corresponding to the target character contains the target font.
[0030] In one embodiment, determining a target font of a target character of a subtitle to be displayed includes:
[0031] When the playback process is started, obtaining the target characters of the subtitles to be displayed;
[0032] The target font required to display the target character is determined.
[0033] In a second aspect, an embodiment of the present application provides a subtitle display device, including:
[0034] A font determination module, used to determine a target font of a target character corresponding to a subtitle to be displayed;
[0035] A font query module, used for querying the target font corresponding to the target character in an index table, wherein the index table includes: a plurality of characters, a plurality of fonts corresponding to the plurality of characters, and storage paths of the plurality of characters in each font;
[0036] A path acquisition module, configured to acquire a target storage path of the target character in the target font when the target font corresponding to the target character is found in the index table;
[0037] A character acquisition module, used for acquiring a target character of the target font according to the target storage path;
[0038] The subtitle display module is used to display the subtitles according to the target characters of the target font.
[0039] In one embodiment, the device further comprises:
[0040] A font set acquisition module, used to acquire a font set;
[0041] A traversal module, used for traversing each font file in the font set to obtain each character of each font;
[0042] A corresponding font determination module, used for determining the fonts corresponding to the characters according to the characters of the fonts;
[0043] A path determination module, used for determining the storage path of each character of each font according to the storage path of each character in each font file;
[0044] The index table generating module is used to generate the index table according to each of the characters, each of the fonts corresponding to each of the characters and the storage path of each of the characters in each of the fonts.
[0045] In one embodiment, the device further comprises:
[0046] An acquisition module, configured to acquire a font set when the target font corresponding to the target character cannot be found in the index table;
[0047] A query module, used for searching the target character of the target font in each font file in the font set;
[0048] A target character acquisition module, configured to acquire the target character of the target font when the target character of the target font is found in each font file in the font set;
[0049] A display module is used to display the subtitles according to the target characters of the target font.
[0050] In one embodiment, the device further comprises:
[0051] A deleting module, configured to delete the index table when the target character of the target font is found in each font file in the font set;
[0052] Generate module, used to generate new index table.
[0053] In one embodiment, the device further comprises:
[0054] A reference character determination module, configured to determine the target character of the target font as a reference character when the target character of the target font cannot be found in each font file in the font set;
[0055] A reference display module is used to display the subtitles according to the reference characters.
[0056] In one embodiment, the font query module includes:
[0057] A character query unit, used for querying the target character in the index table;
[0058] The font query unit is used to query whether each font corresponding to the target character contains the target font when the target character is found in the index table.
[0059] In one embodiment, the font determination module includes:
[0060] A target character acquisition unit, used for acquiring the target character of the subtitle to be displayed when the playback process is started;
[0061] The target font determination unit is used to determine the target font required to display the target character.
[0062] In a third aspect, an embodiment of the present application further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps in the above-mentioned subtitle display method when executed by the processor.
[0063] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above-mentioned subtitle display method are implemented.
[0064] In a fifth aspect, the embodiments of the present application further provide a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in various optional implementations described in the embodiments of the present application.
[0065] In summary, in the embodiment of the present application, the index table contains multiple characters, multiple fonts corresponding to the multiple characters, and the storage paths of the multiple characters of each font, so the target storage path of the target character of the target font can be quickly obtained by querying the index table; and the target character of the target font can be directly obtained according to the target storage path without opening each font file in turn to find the target character of the target font, and the display of the subtitles can be quickly completed. In this way, the time to obtain the target character of the target font can be greatly shortened, the display speed of the subtitles can be accelerated, and the display efficiency of the subtitles can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the technical solutions in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0067] Figure 1 It is a schematic diagram of the steps of a subtitle display method provided by an embodiment of the present application;
[0068] Figure 2 It is a schematic diagram of the steps of a subtitle display method provided by an embodiment of the present application;
[0069] Figure 3 It is a flowchart of a subtitle display method provided by an embodiment of the present application;
[0070] Figure 4 is a structural schematic diagram of a subtitle display device provided by an embodiment of the present application;
[0071] Figure 5 It is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0072] The following will be combined with the drawings in this application to clearly and completely describe the technical solutions in this application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments in the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0073] In one embodiment, Figure 1 As shown, a subtitle display method is provided. Although a logical order is shown in the step diagram, in some cases, the steps shown or described may be performed in an order different from that shown in the figure. Specifically, the subtitle display method may be applied to a terminal, wherein the terminal may include but is not limited to one or more of a smart phone, a tablet computer, a portable computer, a desktop computer, and a vehicle-mounted computer.
[0074] It should be noted that the order of description of the following embodiments is not intended to limit the priority order of the embodiments.
[0075] according to Figure 1 The subtitle display method shown in the figure at least includes steps S110 to S160, which are described in detail as follows:
[0076] In step S110, a target font of a target character corresponding to a subtitle to be displayed is determined.
[0077] The subtitles to be displayed may be any subtitles containing characters. The characters may be characters with multiple fonts to choose from, and the characters may be text or other symbols in various languages. Font refers to the style and form of characters, and is the external form of the characters. The target characters may be any characters, and the target font may be any font. The fonts of the characters of the subtitles to be displayed may be the same or different.
[0078] Optionally, the determining of the target font of the target characters of the subtitles to be displayed may include: when the playback process is started, acquiring the target characters of the subtitles to be displayed; and determining the target font required to display the target characters.
[0079] When the playback process corresponding to the subtitle is started, the target characters in the subtitle to be displayed are obtained from the subtitle file, and the target font required to display the target characters is determined.
[0080] In one embodiment, the target character may be a word such as "T" or "OK", or may be various punctuation marks; each target character may have multiple fonts, such as Kaiti, New Roman, or Hei Ti. The same character may be displayed in different shapes in different fonts. When displaying the target character of the subtitle, it is necessary to determine which font to use to display the target character. Therefore, it is necessary to determine the target font required to display the target character.
[0081] The technical solution of the embodiment of the present application can quickly display subtitles. Therefore, the target font of the target character is determined when the playback process starts. Compared with pre-determining the target font of the target character before the playback process starts, it can avoid the waste of resources caused by not playing the subtitles later without affecting the subtitle display.
[0082] In step S120, the target font corresponding to the target character is searched in an index table.
[0083] The index table includes: a plurality of characters, a plurality of fonts corresponding to the plurality of characters, and storage paths of the plurality of characters in each font.
[0084] The font configuration software tool (Fontconfig) can be used to realize the fast display of subtitles. The fonts file of the font configuration software tool specifies the supported font collection; the cache file of the font configuration software tool specifies the storage path of each character of each font.
[0085] The index table may be pre-generated and stored in a cache file, as shown in Table 1. The index table includes at least: a plurality of characters, a plurality of fonts corresponding to each character, and a storage path of each character in each font. The font corresponding to a character refers to the font of the character. Optionally, the index table may also include the font library file where the characters of each font are located.
[0086] Table 1. Index table
[0087]
[0088] As can be seen from Table 1, the character T has multiple fonts such as Courier, Tiresias and Open Sans, among which the character T of the Courier font is stored in the font file "cour.ttf", and the storage path of the character T of the Courier font is " / data / tcluniplayer / fontconfig / font / cour.ttf".
[0089] Optionally, the characters in the index table may be sorted in sequence, and the fonts corresponding to the characters may also be sorted in sequence, so as to speed up the query of the index table.
[0090] When the player process starts, it will detect the availability of the font configuration software tool. If the font configuration software tool is available and the index table in the cache file exists, the pre-generated index table can be directly obtained from the cache file. If the index table does not exist, the index table is rebuilt according to the font file collection in the fonts file.
[0091] The target font corresponding to the target character refers to the target font of the target character. As shown in Table 1, Courier, Tiresias and Open Sans are the fonts corresponding to the character T.
[0092] Optionally, querying the target font corresponding to the target character in the index table may include: querying the target character in the index table; and when the target character is found in the index table, querying whether various fonts corresponding to the target character include the target font.
[0093] Check whether the target character exists in the index table. If the target character does not exist in the index table, then the target font corresponding to the target character naturally does not exist either.
[0094] If the target character exists in the index table, it can be queried whether there is a target font corresponding to the target character from among multiple fonts corresponding to the target character.
[0095] Among them, because each character in the index table is sorted in order, each font corresponding to each character is also sorted in order, so when querying whether the target character exists in the index table and whether the target font exists in the font corresponding to the target character, the search can be performed in order.
[0096] In this way, by querying whether there is a target font corresponding to the target character in the index table, it can be quickly determined whether the font file corresponding to the index table contains the target font corresponding to the target character.
[0097] In step S130, when the target font corresponding to the target character is found in the index table, a target storage path of the target character in the target font is obtained.
[0098] When the target font corresponding to the target character is queried in the index table, the target storage path of the target character in the target font can be directly obtained from the index table.
[0099] In step S140, the target characters of the target font are acquired according to the target storage path.
[0100] The target characters of the target font can be directly obtained according to the target storage path.
[0101] In step S150, the subtitles are displayed according to the target characters of the target font.
[0102] After the target characters of the target font are acquired, the target characters can be displayed. After the target characters of each target font of the subtitle are acquired, the subtitle can be displayed.
[0103] According to the technical solution of the embodiment of the present application, the index table includes multiple characters, multiple fonts corresponding to the multiple characters, and the storage paths of the multiple characters of each font. Therefore, by querying the index table, the target storage path of the target character of the target font can be quickly obtained; and the target character of the target font can be directly obtained according to the target storage path without opening each font file in turn to find the target character of the target font, so that the display of the subtitles can be completed quickly. In this way, the time to obtain the target character of the target font can be greatly shortened, the display speed of the subtitles can be accelerated, and the display efficiency of the subtitles can be improved.
[0104] Based on the above technical solution, as an embodiment, Figure 2 As shown, before searching the index table for the target font corresponding to the target character, the method may further include steps S210 to S250.
[0105] In step S210, a character set is obtained.
[0106] In step S220, each character library file in the character library set is traversed to obtain each character of each font.
[0107] The font set includes multiple font files, and the multiple font files include various characters of various fonts. By traversing various font files in the font set, various characters of various fonts can be obtained.
[0108] In step S230, the fonts corresponding to the characters are determined according to the characters of the fonts.
[0109] By arranging the characters of each font according to the characters, the fonts corresponding to each character can be determined.
[0110] For example, if there are character T in Courier font, character T in Tiresias font, character T in Open Sans font, character L in Courier font, and character L in Tiresias font, it can be determined that character T has the following three fonts: Courier, Tiresias, and Open Sans; character L has the following two fonts: Courier and Tiresias.
[0111] In step S240, the storage path of each character in each font is determined according to the storage path of each character in each font library file.
[0112] Each character of each font is obtained from each font library file, so the storage path of each character of each font can be determined according to the storage path of the font library file where each character of each font is located.
[0113] In step S250, the index table is generated according to the characters, the fonts corresponding to the characters, and the storage paths of the characters in the fonts.
[0114] The index table is generated according to each of the characters, the fonts corresponding to each of the characters, and the storage paths of each of the characters in each of the fonts. The characters, the fonts corresponding to the characters, and the storage paths of each of the characters in each of the fonts may be stored correspondingly to generate an index table as shown in Table 1.
[0115] Optionally, the characters in the index table may be sorted in sequence, and the fonts corresponding to the characters may also be sorted in sequence, so as to speed up the query of the index table.
[0116] By adopting the technical solution of the embodiment of the present application, each character of each font is obtained by traversing each font file in the font collection, and then redirecting each character of each font to generate an index table, and then the storage path of each character of each font can be directly determined from the index table, so as to realize the fast search of each character of each font, thereby speeding up the display speed of subtitles. In addition, the characters and fonts in the index table are sorted in order, which can further speed up the speed of querying the index table.
[0117] Based on the above technical solution, as an embodiment, Figure 3 FIG. 1 is a flow chart of a subtitle display method provided by an embodiment of the present application. Figure 3 As shown, after searching the target font corresponding to the target character in the index table, the method may further include: when the target font corresponding to the target character cannot be found in the index table, obtaining a character set; searching for the target character of the target font in each character file in the character set; when the target character of the target font is found in each character file in the character set, obtaining the target character of the target font; and displaying the subtitles according to the target character of the target font.
[0118] When the target font corresponding to the target character cannot be found in the index table, it is necessary to query whether the target character of the target font is included in each font file of the font set. The font set is obtained, and each font file in the font set is traversed until the target character of the target font is found.
[0119] When the target characters of the target font are found in the font file in the font set, the subtitles are displayed according to the target characters of the target font from the font file.
[0120] By adopting the technical solution of the embodiment of the present application, when the storage path of the target character of the target font does not exist in the index table, the target character of the target font can be queried by traversing each font file in the font set to avoid affecting the display of subtitles.
[0121] Based on the above technical solution, as an embodiment, Figure 3 As shown, after searching for the target character of the target font in each font file in the font set, the method may further include: when the target character of the target font is found in each font file in the font set, deleting the index table; and generating a new index table.
[0122] The target font corresponding to the target character cannot be found in the index table, but the target character of the target font is found in each font file in the font set, which proves that there is a newly added target character of the target font in the font set. Therefore, the index table needs to be updated or a new index table needs to be generated.
[0123] In one embodiment, a thread may be created, and the thread may be used to delete the original index table and generate a new index table. The method for generating the new index table may refer to step S210 to step S250, which will not be described in detail.
[0124] In another embodiment, the character set may be traversed to obtain characters of the newly added font, and the original index table may be incrementally updated according to the characters of the newly added font.
[0125] By adopting the technical solution of the embodiment of the present application, when there are characters of a newly added font in the character library, the index table is updated or a new index table is generated, so that when other characters of other fonts are subsequently obtained, the storage path of the characters of the required font can be quickly obtained according to the new index table.
[0126] Based on the above technical solution, as an embodiment, Figure 3As shown, after searching for the target character of the target font in each character file in the character set, the method may further include: when the target character of the target font cannot be found in each character file in the character set, determining the target character of the target font as a reference character; and displaying the subtitles based on the reference character.
[0127] When the target font corresponding to the target character cannot be found in the index table, and the target character of the target font cannot be found in each font file in the font set, it proves that the target character of the target font does not exist in each current font file.
[0128] In order to avoid that a target character affects the display of the entire subtitle, the target character of the target font may be determined as a reference character, and the reference character may be “□”.
[0129] When the target character in the subtitle is displayed, the reference character may be used as a substitute. When the user sees the reference character, he or she may determine that there is a character that is not normally displayed at the position of the reference character.
[0130] By adopting the technical solution of the embodiment of the present application, the reference character is used to replace the target character for display, which can inform the user that there is a character that is not displayed normally at the position of the reference character, so that the user can obtain the meaning of the target character in the context, reducing the impact on the viewing experience.
[0131] Optionally, as an embodiment, when the target font corresponding to the target character cannot be found in the index table, and the target character of the target font cannot be found in each font file in the font set, target characters of other fonts can be obtained, and when the target characters of the subtitles are displayed, the target characters of other fonts are displayed. Although the display effect of displaying target characters of other fonts is not as good as that of target characters of the target font, it still allows users to obtain the semantics of the target characters, thereby reducing the impact on the user's viewing experience.
[0132] Figure 3 FIG. 1 is a flow chart of a subtitle display method provided by an embodiment of the present application. Figure 3 As shown, in step S310, subtitle rendering starts. In step S320, it is queried whether there is a target character of the target font in the index table. If there is a target character of the target font in the index table, the process jumps to step S330; if there is no target character of the target font in the index table, the process jumps to step S340.
[0133] In step S330, a storage path is obtained, and a target character of a target font is obtained according to the storage path. The storage path is a storage path of the target character of the target font stored in the index table. According to the storage path, the font file storing the target character of the target font can be directly determined, and then the target character of the target font can be directly obtained from the font file. Subtitles are displayed according to the obtained target character of the target font.
[0134] In step S340, the character set is traversed to check whether there is a target character of the target font. If there is a target character of the target font in the character set, steps S350 and S360 are executed; if there is no target character of the target font in the character set, step S370 is executed.
[0135] In step S350, the target characters of the target font are obtained from the character set. In step S360, a new index table is generated. If the target characters of the target font exist in the character set, the target characters of the target font are obtained from the character set, so as to display subtitles according to the target characters of the target font obtained from the character set. Because the target characters of the target font exist in the character set, but the target characters of the target font cannot be found in the index table, it proves that the character set has been added, so a new index table is generated according to the current character set.
[0136] In step S370, the target character of the target font is displayed as a reference character. In order to avoid affecting the display of the entire subtitle due to one target character, the target character of the target font can be determined as a reference character.
[0137] By adopting the technical solution of the embodiment of the present application, the time for acquiring the target characters of the target font can be greatly shortened, the display speed of subtitles can be accelerated, and the display efficiency of subtitles can be improved.
[0138] In order to better implement the subtitle display method of the present application, the present application also provides a subtitle display device based on the above subtitle display method. The meanings of the terms are the same as those in the above subtitle display method, and the specific implementation details can refer to the description in the method embodiment.
[0139] See also Figure 4 , Figure 4 : is a schematic diagram of the structure of a subtitle display device provided in an embodiment of the present application, and the subtitle display device includes:
[0140] The font determination module 401 is used to determine the target font of the target characters corresponding to the subtitles to be displayed;
[0141] A font query module 402 is used to query the target font corresponding to the target character in an index table, wherein the index table includes: a plurality of characters, a plurality of fonts corresponding to the plurality of characters, and storage paths of the plurality of characters in each font;
[0142] A path acquisition module 403, configured to acquire a target storage path of the target character in the target font when the target font corresponding to the target character is found in the index table;
[0143] A character acquisition module 404, configured to acquire a target character of the target font according to the target storage path;
[0144] The subtitle display module 405 is used to display the subtitles according to the target characters of the target font.
[0145] In one embodiment, the device further comprises:
[0146] A font set acquisition module, used to acquire a font set;
[0147] A traversal module, used for traversing each font file in the font set to obtain each character of each font;
[0148] A corresponding font determination module, used for determining the fonts corresponding to the characters according to the characters of the fonts;
[0149] A path determination module, used for determining the storage path of each character of each font according to the storage path of each character in each font file;
[0150] The index table generating module is used to generate the index table according to each of the characters, each of the fonts corresponding to each of the characters and the storage path of each of the characters in each of the fonts.
[0151] In one embodiment, the device further comprises:
[0152] An acquisition module, configured to acquire a font set when the target font corresponding to the target character cannot be found in the index table;
[0153] A query module, used for searching the target character of the target font in each font file in the font set;
[0154] A target character acquisition module, configured to acquire the target character of the target font when the target character of the target font is found in each font file in the font set;
[0155] A display module is used to display the subtitles according to the target characters of the target font.
[0156] In one embodiment, the device further comprises:
[0157] A deleting module, configured to delete the index table when the target character of the target font is found in each font file in the font set;
[0158] Generate module, used to generate new index table.
[0159] In one embodiment, the device further comprises:
[0160] A reference character determination module, configured to determine the target character of the target font as a reference character when the target character of the target font cannot be found in each font file in the font set;
[0161] A reference display module is used to display the subtitles according to the reference characters.
[0162] In one embodiment, the font query module 402 includes:
[0163] A character query unit, used for querying the target character in the index table;
[0164] The font query unit is used to query whether each font corresponding to the target character contains the target font when the target character is found in the index table.
[0165] In one embodiment, the font determination module 401 includes:
[0166] A target character acquisition unit, used for acquiring the target character of the subtitle to be displayed when the playback process is started;
[0167] The target font determination unit is used to determine the target font required to display the target character.
[0168] According to the technical solution of the embodiment of the present application, the index table includes multiple characters, multiple fonts corresponding to the multiple characters, and the storage paths of the multiple characters of each font. Therefore, by querying the index table, the target storage path of the target character of the target font can be quickly obtained; and the target character of the target font can be directly obtained according to the target storage path without opening each font file in turn to find the target character of the target font, so that the display of the subtitles can be completed quickly. In this way, the time to obtain the target character of the target font can be greatly shortened, the display speed of the subtitles can be accelerated, and the display efficiency of the subtitles can be improved.
[0169] For the specific definition of the subtitle display device, please refer to the definition of the subtitle display method above, which will not be repeated here. Each module in the above subtitle display device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0170] In addition, the present application also provides an electronic device, such as Figure 5 As shown, it shows a schematic diagram of the structure of the electronic device involved in this application, specifically:
[0171] The electronic device may include one or more processors 501 of processing cores and one or more computer-readable storage media memories 502 and other components. Those skilled in the art will appreciate that Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0172] The processor 501 is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 502, and calling data stored in the memory 502, the processor 501 performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. Optionally, the processor 501 may include one or more processing cores; preferably, the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 501.
[0173] The memory 502 can be used to store software programs and modules. The processor 501 executes various functional applications and data processing by running the software programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 502 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 with access to the memory 502.
[0174] In one embodiment, the electronic device further includes a power supply 503 for supplying power to various components. Preferably, the power supply 503 can be logically connected to the processor 501 through a power management system, so as to manage charging, discharging, power consumption and other functions through the power management system. The power supply 503 can also include one or more DC or AC power supplies, recharging systems, power supply device debugging circuits, power converters or inverters, power status indicators and other arbitrary components.
[0175] In one embodiment, the electronic device may further include an input unit 504, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0176] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 501 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 502 according to the following instructions, and the processor 501 will run the application programs stored in the memory 502, thereby implementing the steps in any of the subtitle display methods provided in the embodiments of the present application.
[0177] Those skilled in the art will understand that Figure 5 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0178] In one embodiment, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method described in any embodiment of the present application is implemented.
[0179] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method described in any embodiment of the present application is implemented.
[0180] In some embodiments, a computer program product is also proposed, including a computer program or instructions, which implement the method described in any embodiment of the present application when executed by a processor.
[0181] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0182] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0183] To this end, the present application provides a computer-readable storage medium, on which a computer program is stored. The computer program can be loaded by a processor to execute the steps in any subtitle display method provided in the present application.
[0184] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0185] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0186] Since the instructions stored in the computer-readable storage medium can execute the steps in any subtitle display method provided in the present application, the beneficial effects that can be achieved by any subtitle display method provided in the present application can be achieved. Please refer to the previous embodiments for details, which will not be repeated here.
[0187] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0188] The above is a detailed introduction to a subtitle display method, device, electronic device and computer-readable storage medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A subtitle display method, characterized in that: include: Determining a target font for target characters corresponding to subtitles to be displayed; Searching the target font corresponding to the target character in an index table, wherein the index table includes: a plurality of characters, a plurality of fonts corresponding to the plurality of characters, and storage paths of the plurality of characters in each font; When the target font corresponding to the target character is found in the index table, a target storage path of the target character in the target font is obtained; According to the target storage path, obtaining the target characters of the target font; The subtitles are displayed according to the target characters of the target font.
2. The method according to claim 1, characterized in that Before searching the index table for the target font corresponding to the target character, the method further includes: Get the font set; Traversing each font file in the font set to obtain each character of each font; According to the characters of the fonts, determining the fonts corresponding to the characters; Determining the storage path of each character of each font according to the storage path of each character in each font file; The index table is generated according to each of the characters, each of the fonts corresponding to the characters, and a storage path of each of the characters in each of the fonts.
3. The method according to claim 1, characterized in that After searching the index table for the target font corresponding to the target character, the method further includes: When the target font corresponding to the target character cannot be found in the index table, obtaining a font set; Searching for the target character of the target font in each font file in the font set; When the target character of the target font is found in each font file in the font set, the target character of the target font is acquired; The subtitles are displayed according to the target characters of the target font.
4. The method according to claim 3, characterized in that After searching each character library file in the character library set for the target character of the target font, the method further includes: When the target character of the target font is found in each font file in the font set, deleting the index table; Generate a new index table.
5. The method according to claim 3, characterized in that: After searching each character library file in the character library set for the target character of the target font, the method further includes: When the target character of the target font cannot be found in each font file in the font set, determining the target character of the target font as a reference character; The subtitles are displayed according to the reference characters.
6. The method according to claim 1, characterized in that The step of searching the index table for the target font corresponding to the target character includes: Searching the target character in the index table; When the target character is found in the index table, it is queried whether each font corresponding to the target character contains the target font.
7. The method according to any one of claims 1 to 6, characterized in that: The step of determining a target font of a target character of a subtitle to be displayed comprises: When the playback process is started, obtaining the target characters of the subtitles to be displayed; The target font required to display the target character is determined.
8. A subtitle display device, characterized in that: include A font determination module, used to determine a target font of a target character corresponding to a subtitle to be displayed; A font query module, used for querying the target font corresponding to the target character in an index table, wherein the index table includes: a plurality of characters, a plurality of fonts corresponding to the plurality of characters, and storage paths of the plurality of characters in each font; A path acquisition module, configured to acquire a target storage path of the target character in the target font when the target font corresponding to the target character is found in the index table; A character acquisition module, used for acquiring a target character of the target font according to the target storage path; The subtitle display module is used to display the subtitles according to the target characters of the target font.
9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the subtitle display method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the subtitle display method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Subtitle display method, electronic device and computer-readable storage medium
WO2026157879A1