CN116136890A - Webpage display method and terminal equipment - Google Patents

Webpage display method and terminal equipment Download PDF

Info

Publication number
CN116136890A
CN116136890A CN202111372338.6A CN202111372338A CN116136890A CN 116136890 A CN116136890 A CN 116136890A CN 202111372338 A CN202111372338 A CN 202111372338A CN 116136890 A CN116136890 A CN 116136890A
Authority
CN
China
Prior art keywords
webpage
font
displayed
web page
scene
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111372338.6A
Other languages
Chinese (zh)
Inventor
刘耀明
卢亮
张学扶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Petal Cloud Technology Co Ltd
Original Assignee
Petal Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Petal Cloud Technology Co Ltd filed Critical Petal Cloud Technology Co Ltd
Priority to CN202111372338.6A priority Critical patent/CN116136890A/en
Publication of CN116136890A publication Critical patent/CN116136890A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents

Abstract

The application discloses a webpage display method and terminal equipment, which can realize that a webpage to be displayed follows the font thickness of a system. The webpage display method is applied to terminal equipment and comprises the following steps: acquiring a first font thickness coefficient corresponding to system style information, wherein the first font thickness coefficient is a font thickness coefficient corresponding to a new text style after a user changes the text style of the system; and adjusting the font thickness of the webpage to be displayed according to the first font thickness coefficient.

Description

Webpage display method and terminal equipment
Technical Field
The present disclosure relates to the field of computers, and in particular, to a web page display method and a terminal device.
Background
With the gradual maturity of network technology, more and more application programs (APP) in terminal devices such as mobile phones are set as embedded web page view (Webview) components to promote development efficiency and improve use experience. The Webview component can implement rendering of web content using a self-rendering engine that is independent of a native View (View) component of the terminal device. After the font thickness option in the system setting of the terminal device is adjusted, the native view component of the terminal device can dynamically change the font thickness of the text display along with the change of the system font thickness, but the Webview component may not be able to dynamically follow the system font thickness, which may result in poor user experience effect.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a web page display method and a terminal device, which can implement that a web page to be displayed follows the font thickness of a system.
In a first aspect, an embodiment of the present application provides a web page display method, applied to a terminal device, where the method includes: acquiring a first font thickness coefficient corresponding to system style information, wherein the first font thickness coefficient is a font thickness coefficient corresponding to a new text style after a user changes the text style of the system; and adjusting the font thickness of the webpage to be displayed according to the first font thickness coefficient.
According to the first aspect of the application, after the font thickness coefficient corresponding to the system style information is adjusted, the font thickness of the webpage to be displayed can be adjusted according to the font thickness coefficient corresponding to the new text style after the user changes the text style of the system, so that the problem that the webpage to be displayed follows the system font thickness and the webpage typesetting negative experience is caused because the webpage cannot follow the system font thickness can be solved.
The "system" herein generally refers to an operating system running on a terminal device, where the operating system is the basis for running various applications on the terminal device, including web applications such as a browser.
According to some embodiments of the present application, the obtaining the first font thickness coefficient corresponding to the system style information includes: and acquiring the first font thickness coefficient through a system server of a system application framework layer. According to the method and the device, the system server of the system application framework layer is used for obtaining the first font thickness coefficient, and the first font thickness coefficient can be obtained after the font thickness coefficient corresponding to the system style information is adjusted.
According to some embodiments of the application, the first font thickness coefficient is a font thickness coefficient adjustment event notification obtained by the system server based on a user operation, and the first font thickness coefficient is obtained from the system server. After the font thickness coefficient corresponding to the system style information is adjusted through the system server, the webpage display component is notified, and the webpage display component acquires the first font thickness coefficient from the system server according to the notification, so that the webpage display component can acquire the first font thickness coefficient immediately after the font thickness coefficient corresponding to the system style information is adjusted.
According to some embodiments of the present application, the adjusting the font thickness of the web page to be displayed according to the first font thickness coefficient includes: adjusting a system font file according to the first font thickness coefficient; and adjusting the font thickness of the webpage to be displayed according to the adjusted system font file. According to the method and the device for adjusting the font thickness of the webpage to be displayed, the system font file is adjusted according to the first font thickness coefficient, and the font thickness of the webpage to be displayed is adjusted according to the adjusted system font file, so that the font thickness adjustment during the drawing of the webpage to be displayed can be achieved.
According to some embodiments of the present application, before said adjusting the system font file according to the first font thickness coefficient, the method further comprises: and storing the system font file. By additionally storing the system font file, the method can avoid the system font file from being covered, and can realize the display of the webpage to be displayed when the font thickness of the webpage is not adjusted according to the font thickness coefficient of the system.
According to some embodiments of the present application, the method further comprises: identifying a scene of the webpage to be displayed, wherein the scene is used for indicating whether the webpage to be displayed adjusts the font thickness of the webpage according to the new font thickness coefficient after the system is changed; the adjusting the font thickness of the webpage to be displayed according to the first font thickness coefficient comprises: and if the scene indicates that the webpage to be displayed needs to adjust the font thickness of the webpage according to the new font thickness coefficient after the system is changed, adjusting the font thickness of the webpage to be displayed according to the first font thickness coefficient. According to the method and the device, the scene of the webpage to be displayed can be identified, when the fact that the webpage to be displayed needs to be adjusted according to the new font thickness coefficient after the system is changed is determined, the font thickness of the webpage to be displayed is followed by the system font thickness, and the self-adaptive layout optimization adjustment of the webpage to be displayed according to the thickness change can be achieved.
According to some embodiments of the present application, the method further comprises: and if the scene indicates that the webpage to be displayed does not need to adjust the font thickness of the webpage according to the new font thickness coefficient after the system is changed, displaying the webpage to be displayed according to the second font thickness coefficient. According to the method and the device for displaying the webpage, when the fact that the webpage to be displayed does not need to adjust the font thickness of the webpage according to the new font thickness coefficient after the system is changed is determined, the font thickness of the system is not followed, and interface layout confusion of an application program can be avoided.
According to some embodiments of the present application, the second font thickness coefficient is a font thickness coefficient corresponding to a text style before the system is changed, or the second font thickness coefficient is a default font thickness coefficient of the web page to be displayed. According to the method and the device, the second font thickness coefficient is the font thickness coefficient corresponding to the text style before system modification or is the default font thickness coefficient of the webpage to be displayed, and the font thickness coefficient required by display when the webpage to be displayed is not displayed along with the system font thickness can be specifically limited.
In a second aspect, an embodiment of the present application provides a web page display method, applied to a terminal device, where the method includes: identifying a scene of a webpage to be displayed, wherein the scene is used for indicating whether the webpage to be displayed adjusts the text of the webpage according to a new text style after system modification; if the scene indicates that the webpage to be displayed needs to adjust the text style of the webpage according to the new text style after the system is changed, acquiring a first text style corresponding to the system style information, and adjusting the text style of the webpage to be displayed according to the first text style, wherein the first text style is the new text style after the user changes the text style of the system; and if the scene indicates that the webpage to be displayed does not need to adjust the text style of the webpage according to the new text style after the system is changed, displaying the webpage to be displayed according to the second text style.
According to the method and the device, the scene of the webpage to be displayed is identified, whether the text style of the webpage is adjusted is determined according to the identified scene, the text style of the webpage following system to be displayed can be achieved, the text style of the system is followed or not followed according to different scenes, negative experience caused by certain scenes is avoided, and isolation of the text style of the webpage can be achieved.
According to some embodiments of the present application, the text style includes one or more of the following: font, font thickness, font color, font position, font shape, font effect, or font size. The font shapes include regular, italic, bold, and/or bold italic, etc. The font effects include strikethrough, underlining, and/or highlighting, etc. Material that is appended to the text itself may be referred to as a font effect, such as outline, halo, shading, and/or reflection, etc. The present application may specifically define text styles.
According to some embodiments of the present application, the first scene indicates that the webpage to be displayed does not need to adjust the text style of the webpage according to the new text style after the system is changed, and the first scene satisfies one or more of the following situations: the method comprises the steps that a text style which does not follow a system is defined in a meta tag, the text of the webpage to be displayed uses online fonts or mixed fonts, the webpage to be displayed is a plurality of pages with different fonts, the webpage to be displayed is of a layout with fixed width and height and full characters, or the webpage to be displayed is a malicious website or a risk website. The application can specifically define the scene that the webpage to be displayed does not need to adjust the text style of the webpage according to the new text style after the system is changed.
According to some embodiments of the present application, the second scene indicates that the webpage to be displayed needs to adjust the text style of the webpage according to the new text style after the system is changed, and the second scene satisfies one or more of the following situations: and defining a text style of a following system in the meta tag, or defining the webpage to be displayed as a multi-text page. The application can specifically define the scene that the webpage to be displayed needs to adjust the text style of the webpage according to the new text style after the system is changed.
In a third aspect, an embodiment of the present application provides a terminal device, including a processor, a memory, and a computer program stored in the memory and executable by the processor, where the processor executes the program to implement a web page display method according to any one of the possible implementation manners of the first aspect or the second aspect.
In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, where a program is stored, where the program causes a terminal device to execute the method for displaying a web page according to any one of the possible implementation manners of the first aspect or the second aspect.
In a fifth aspect, an embodiment of the present application provides a computer program product comprising computer instructions which, when executed by one or more processors, implement a method of displaying a web page as described above in any one of the possible implementation manners of the first or second aspect.
In a sixth aspect, an embodiment of the present application provides a web page display device, where the web page display device includes one or more modules, and these modules are configured to implement a web page display method according to any one of the possible implementation manners of the first aspect or the second aspect.
The advantages of the third to sixth aspects and various implementations thereof may be referred to for analysis of the advantages of the first aspect, the second aspect and various implementations thereof, and are not described here in detail.
Drawings
FIG. 1A is a diagram of a prior art web page of a first application program with no font adjustment in system settings.
FIG. 1B is a diagram illustrating a "text overflow" phenomenon of a web page of a first application according to the prior art.
Fig. 2A is a schematic diagram of a web page of a second application of the prior art when the font in the system setting is not adjusted.
Fig. 2B is a schematic diagram of a "font size confusion" phenomenon existing in a web page of a second application program in the prior art.
Fig. 3 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Fig. 4 is a schematic logic architecture diagram of a terminal device according to an embodiment of the present application.
Fig. 5 is a flowchart of a web page display method according to an embodiment of the present application.
Fig. 6 is a flowchart of a scene of recognizing a layout of a fixed width and height and full text according to an embodiment of the present application.
Fig. 7 is a schematic diagram of a typeset web page provided in an embodiment of the present application.
Fig. 8 is a flowchart of a method for identifying a scene according to an embodiment of the present application.
Fig. 9 is a process schematic diagram of a web page display method according to an embodiment of the present application.
Fig. 10 is a schematic logic structure diagram of a web page display device according to an embodiment of the present application.
Fig. 11 is a schematic logic structure diagram of another web page display device according to an embodiment of the present application.
Detailed Description
In the description of embodiments of the present application, words such as "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. It should be understood that in this application, unless otherwise indicated, "a plurality" means two or more than two.
In the prior art, a part of Webview component may dynamically change the font thickness of the text display along with the change of the font thickness of the system, but the dynamic following of the font thickness of the system may cause the interface layout of the application program to be displayed in a very chaotic manner. As shown in fig. 1A, a page of a first application APP in a terminal device is displayed with content. For example, in fig. 1A, the words "Profile", "5 Answers", "10 Questions", "0 Shares", "6 Posts" are displayed on the page. It will be appreciated that the page may also be displayed with other content, which is not limiting in this application. After the fonts in the system settings of the terminal device are bolded, a part of the text on the page exceeds the layout area, resulting in an incomplete display, for example in fig. 1B, the text "6 Posts" is displayed as "6 Posts" only on the page of the first application APP. As shown in fig. 2A, the page of the second application APP in the terminal device is displayed with a novel. For example, in FIG. 2A, the page has displayed thereon the word "when she is smiling for the first time she sees a small nuance. Curved eyebrows and shallow dimples, with fair skin, make she look like a dance fairy. ". Wherein, part of the characters on the page are system fonts and part of the characters are online fonts. It will be appreciated that the page may also be displayed with other content, which is not limiting in this application. After the fonts in the system settings of the terminal device are thickened, the online fonts on the page can adjust the thickness along with the system settings because the online fonts on the page do not support the variable font characteristics, but the online fonts on the page cannot adjust the thickness along with the system settings, and the phenomenon of disordered font thickness on the page can occur, as shown in fig. 2B. The phenomenon shown in fig. 1B and 2B will result in a poor user experience.
Fig. 3 shows an example of a terminal device provided in an embodiment of the present application. In fig. 3, terminal device 300 includes a communication subsystem 310, a power supply 320, an input device 330, a display device 340, a processing unit 350, and a memory 360. Memory 360 stores computer programs or instructions including application programs 392 and operating system 394, among others. The processing unit 350 is configured to execute a computer program in the memory 360, thereby implementing the method defined by the computer program.
The processing unit 350 may include one or more processors, for example, the processing unit 350 may include an application processor, a graphics processor, a digital signal processor, and the like. When the processing unit 350 includes a plurality of processors, the plurality of processors may be integrated on the same chip, or may be separate chips.
Memory 360 also stores other data 396 in addition to computer programs, which other data 396 may include data generated during operation of operating system 394 or application 392, such as system data (e.g., configuration parameters of operating system 394) and user data (e.g., a cache in a web page display component embedded in application 392).
The memory 360 generally includes memory and external storage. Memory includes, but is not limited to, random access memory (randomaccess memory, RAM), read-only memory (ROM), or cache, among others. External memory includes, but is not limited to, flash memory (flash memory), hard disk, universal serial bus (universal serial bus, USB) disk, etc., on which computer programs are typically stored, from which processing unit 350 loads the programs into memory before executing the computer programs.
In one embodiment, the operating system 394 includes a computer program for implementing the web page display method provided in the embodiments of the present application, so that after the processing unit 350 runs the operating system 394, the steps of the web page display method provided in the embodiments of the present application are implemented.
An input device 330 for receiving user input information, such as numeric/character information, touch operations or gestures, and generating corresponding input signals. Specifically, in one embodiment, the input device 330 includes a touch panel. The touch panel, also referred to as a touch screen, may collect touch operations by a user thereon and generate touch signals to drive related components in response to the user's operations. In addition to a touch panel, the input device 330 may also include other input devices including, but not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc.
The display device 340 may be a display panel such as a liquid crystal display (liquid crystal display, LCD), an organic light-emitting diode (OLED), or the like. In some embodiments, a touch panel may be overlaid on the display device 340 to form a touch display screen.
The communication subsystem 310 is a basic communication unit of the terminal device 300, and is used for data transmission and reception of the terminal device 300. The power supply 320 is used to supply power to the above components, and may be specifically a power management chip.
When the terminal device 300 is a wireless terminal, the communication subsystem 310 includes a wireless modem (wireless modem) to mainly implement baseband processing, modulation and demodulation, signal amplification and filtering, equalization, and so on. In one embodiment, the communication subsystem 310 includes: a baseband processor, radio frequency circuitry, and an antenna. The radio frequency circuit and the antenna are mainly responsible for signal transmission and reception; the baseband processor is responsible for signal processing such as a/D, D/a conversion of signals, encoding and decoding of signals, and the like. The baseband processor supports one or more of the wireless communication standards including, but not limited to, global system for mobile communications (global system for mobile communications, GSM), code division multiple access (code divisionmultiple access, CDMA), wideband code division multiple access (wideband code division multiple access, WCDMA), high speed packet access (high speed packet access, HSPA), long Term Evolution (LTE), etc. The baseband processor may be a separate chip or may be integrated with the processor included in processing unit 350 in the same chip.
Optionally, the terminal device 300 further comprises one or more sensors 380, such as acceleration sensors, light sensors, etc.
The web page display method provided in the embodiments of the present application may be performed by an appropriate combination of software, hardware, and/or firmware of the terminal device 300. For example, it may be implemented by operating system 394, shown in FIG. 3, in combination with the necessary hardware.
Moreover, those skilled in the art will appreciate that terminal device 300 may include fewer or more components than are shown in FIG. 3, and that terminal device 300 shown in FIG. 3 is merely illustrative of components that are more relevant to the various implementations disclosed in embodiments of the present application.
In one embodiment, the components contained by terminal device 300 may be logically divided into a hardware layer 31, an operating system 394, and an application layer 39 as shown in FIG. 4. The hardware layer 31 includes hardware resources such as a power supply 320, an input device 330, a processing unit 350 of a display device 340, and a memory 360. The application layer 39 includes aOne or more applications, such as application 392, application 392 may be a social-type application, a shopping-type application (e.g., a shopping-type application
Figure BDA0003362768320000051
) Any type of application, media player, browser, etc. The user interface 3923 of application 392 includes web pages 3925 and other controls. The operating system 394 acts as a software middleware between the hardware layer 31 and the application layer 39, and is a computer program that manages and controls hardware and software resources. In one embodiment, operating system 394 includes kernel 33, libraries (libraries) and runtime (runtimes) 35, and framework (frames) 37. Wherein the kernel 33 is used to provide underlying system components and services, such as: security, memory management, process management, hardware driving, etc.; the hardware drivers include a display driver 331, a processor driver 335, a memory driver 337, and the like. The library and runtime 35, also called a runtime library, provides the executable with the required library files and execution environment at runtime. In one embodiment, the library and runtime 35 includes a system runtime 351, a web runtime 352, and a function library 358. The system runtime 351 is a running environment of an operating system, such as a virtual machine. The web runtime 352 mainly includes a web execution environment (pagecontext) 353 and a script execution environment (script context) 355, where the web execution environment 353 parses web source codes in html, css and other formats through a corresponding function library, and the script execution environment 355 parses and executes codes or executable files implemented by script languages such as JavaScript and the like through the corresponding function library. The function library 358 is a computer program library that provides support for executable programs at runtime, including browser engines (such as webkit), graphics processing engines, and the like. The framework layer 37 includes a system server 371 for providing various underlying common components and services, such as window management, font management, location management, etc., for the applications in the application layer 39. Those skilled in the art will appreciate that terminal device 300 may include fewer or more components than those shown in FIG. 4, the terminal device shown in FIG. 4 including only components more relevant to the various implementations disclosed in embodiments of the present application 。
In one embodiment, as shown in FIG. 4, a web page 3925 embedded in a user interface 3923 is loaded and displayed by a web page display component 36. The web page display component 36 may be a web page display component included in the operating system 394 for displaying web pages. The web page display component 36 is operative at the system runtime 351 for loading and displaying web pages, which utilize the web run time352 to complete web page parsing rendering and script interpretation execution, ultimately presenting the content of the web pages to the user. According to the webpage display method, the webpage display component 36 obtains the first font thickness coefficient corresponding to the system style information from the system server371 according to the font thickness coefficient adjustment event notification performed after the system server371 obtains the system style information based on the operation of the user, and adjusts the font thickness of the webpage to be displayed according to the first font thickness coefficient. The first font thickness coefficient is a font thickness coefficient corresponding to a new text style after a user changes the text style of the system. It can be appreciated that before the first font thickness coefficient is obtained, the method may further identify a scene of the web page to be displayed, and determine whether to adjust the font thickness of the web page to be displayed according to the scene. The present application is described with reference to font size adjustment, and it is understood that other text style adjustments may be used, such as font adjustment, font color adjustment, font position adjustment, font shape adjustment, font effect adjustment, or font size adjustment. Fonts include Song Ti, simulated Song, regular script, and/or bold, among others. Font shapes include regular, italic, bold, and/or bold italic, etc. Font effects include strikethrough, underlining, and/or highlighting, etc. It is understood that material that is appended to the text itself may be referred to as a font effect, such as outline, halo, shading, and/or reflection, etc. When the font size is represented by a font size, the smaller the font size is, the larger the text is; when font size is expressed in pounds, the larger the text.
Referring to fig. 5, a flowchart of a web page display method according to an embodiment of the present application is provided. The webpage display method shown in fig. 5 is applied to a scene of a webpage to be displayed. The webpage display method comprises the following steps:
s501: the application program is started and the web page display component is initialized.
In some embodiments, the application may be launched based on a first operation by the user, e.g. based on a user operation on an icon in an interface displayed by the terminal device, e.g. on an interface
Figure BDA0003362768320000061
And (5) operating the icons. The application program is embedded with a web page display component to load and display web pages. After the application program is started, the operation of initializing the webpage display component can be executed to finish the preparation work of the webpage display component. The web page display component is a global web page display component that need only be created and initialized when the application program is started.
S502: and in the initialization process, the webpage display component acquires font thickness coefficients corresponding to the system style information from the system server through an open interface.
In some embodiments, the open interface may be a Configuration #fontscale object. The system style information may be directly stored in a separate style file.
S503: the webpage display component synchronizes font thickness coefficients corresponding to the system style information to a rendering engine of the webpage display component.
The rendering engine is also a typesetting engine, and is responsible for obtaining contents of intelligent layout, such as HyperText markup language (HyperText MarkupLanguage, HTML), extensible markup language (EXtensible Markup Language, XML), images, etc., arranging information (such as adding system style information, etc.), calculating a display mode of a web page, etc., and outputting the calculated display mode to a display device. The rendering engine of the webpage display component can acquire the font thickness coefficient corresponding to the system style information from the webpage display component, so that the webpage display component can finish synchronizing the font thickness coefficient corresponding to the system style information to the rendering engine of the webpage display component.
S504: the application program sends a web page loading request to the web page display component.
S505: the webpage display component identifies a scene of the webpage to be displayed according to the webpage loading request.
In some embodiments, the web page display component may obtain a web page to be displayed from a server according to a web page loading request, and identify a scene of the web page to be displayed according to a scene rule. The scene rules include a first scene rule, a second scene rule, a third scene rule, a fourth scene rule, a fifth scene rule, and a sixth scene rule. The identified scene may be a first identified scene, a second identified scene, a third identified scene, a fourth identified scene, a fifth identified scene, a sixth identified scene, a seventh identified scene, or an eighth identified scene. The first scene rule is to detect whether a webpage to be displayed is defined in a meta tag or not to follow a font thickness coefficient corresponding to system style information. The first recognition scene is that a webpage to be displayed defines font thickness coefficients corresponding to system style information which are not followed in a meta tag. The second recognition scene is that the webpage to be displayed defines font thickness coefficients corresponding to the following system style information in the meta tag. The meta tag is an auxiliary tag in the HEAD area of the web page source code described in HTML language, and is located between the HEAD mark and the tip mark of the HTML document. meta tags provide information that is not visible to the user. The meta tag describes an attribute of an HTML web document, such as a font thickness coefficient corresponding to inhibit (disable) following system style information, a font thickness coefficient corresponding to force (enable) following system style information, or a font thickness coefficient corresponding to automatic (auto) following system style information. The web page display component may parse meta tags of the HTLM document when loading the web page, for example, the meta tags include: < meta name= "font-white-match-system-setting" content= "disable" >, meaning that a font thickness coefficient corresponding to prohibit following system style information is defined in the meta tag, the web page display component may identify, according to the web page loading request, a scene of the web page to be displayed as a first identification scene according to a first scene rule. If the webpage display component analyzes the meta tag and determines that the font thickness coefficient corresponding to the forced following system style information is defined in the meta tag, the webpage display component can identify the scene of the webpage to be displayed as a second identification scene according to the first scene rule according to the webpage loading request.
In some embodiments, the second scene rule is to detect whether text of the web page to be displayed uses online fonts or mixed fonts. The third recognition scenario is that the text of the web page to be displayed uses online fonts or mixed fonts. The web page display component may also parse the CSS style of the HTML document when the web page is loaded. CSS style is a language that defines the text style of a system, such as font, font size, font thickness, font color, font position, font shape, or font effect, etc., used to describe the manner in which information is formatted and displayed on a web page. CSS styles may be stored directly in HTML documents. CSS styles of HTML documents can specify custom fonts by @ font-face and be referenced on the HTML document by font-family. For example, the CSS style is:
Figure BDA0003362768320000071
the webpage display component can analyze the CSS style according to the webpage loading request and the second scene rule, and determine that the text of the webpage to be displayed currently uses online fonts according to the analyzed CSS style. The webpage display component recognizes the scene of the webpage to be displayed as a third recognition scene according to the second scene rule according to the webpage loading request. And a section of characters can be defined in the CSS style, part of the characters use online fonts, and part of the characters use system fonts, and then the webpage display component analyzes the CSS style and determines that the text of the webpage to be displayed currently uses mixed fonts according to the analyzed CSS style. The webpage display component recognizes the scene of the webpage to be displayed as a third recognition scene according to the second scene rule according to the webpage loading request. Otherwise, the webpage display component determines that the text of the webpage to be displayed does not use online fonts and mixed fonts according to the webpage loading request and the second scene rule.
In some embodiments, the third context rule is to identify whether the web page to be displayed is a multi-literal page. The fourth recognition scene is that the webpage to be displayed is a multi-text page. The web page display component can parse a DOM (Document Object Model ) tree generated by the HTML document and determine a ratio of text nodes of the DOM tree to a viewable area of the web page body. If the webpage display component judges that the ratio of the text node in the visible area of the webpage text is larger than the preset ratio, the webpage display component identifies the webpage to be displayed as a multi-text page. The webpage display component recognizes the scene of the webpage to be displayed as a fourth recognition scene according to the third scene rule according to the webpage loading request. If the webpage display component judges that the ratio of the text node in the visible area of the webpage text is smaller than or equal to the preset ratio, the webpage display component identifies that the webpage to be displayed is not a multi-text page according to a third scene rule according to the webpage loading request.
In some embodiments, the fourth scene rule is a page that identifies whether the web page to be displayed is set for a plurality of different font-weights (font-weights). The fifth recognition scenario is a page where the web page to be displayed is set for a plurality of different font-weights. The web page display component parses the CSS style of the HTML document. The CSS style of an HTML document can set the font thickness coefficients through font-weight. If the font thickness is greater than the preset value, when the font thickness is adjusted, the font thickness that is desired to be adjusted may not be reached even if the font thickness adjustment reaches the font thickness threshold. CSS style of HTML documents can also specify variable font thickness by font-variation-settings: 'wght'. If the webpage display component determines that the html document of the webpage to be displayed comprises a font-variation-settings attribute of 'wght' by analyzing the CSS style, the webpage display component can identify the webpage to be displayed as a plurality of pages with different font thicknesses (font-weight) set. That is, the webpage display component may identify, according to the fourth scene rule, the scene of the webpage to be displayed as the fifth identification scene according to the webpage loading request. If the webpage display component determines that a plurality of different font thickness styles are defined in the html document of the webpage to be displayed through analyzing the CSS style, the webpage display component can identify the webpage to be displayed as a page set by a plurality of different font-weights. That is, the webpage display component may identify, according to the fourth scene rule, the scene of the webpage to be displayed as the fifth identification scene according to the webpage loading request. If the webpage display component determines that the text thickness in the html document of the webpage to be displayed is larger than the preset value through analyzing the CSS style, the webpage display component can identify the webpage to be displayed as a plurality of different font-weight set pages according to a fourth scene rule according to a webpage loading request.
In some embodiments, the fifth scenario rule is a layout that identifies whether the web page to be displayed is a fixed width-height and text-full. The sixth recognition scene is a layout in which the webpage to be displayed is of a fixed width and height and the characters are full. Referring to fig. 6, a flowchart of a scene of recognizing a layout of characters with a fixed width and height is provided in an embodiment of the present application. Identifying a scene of a fixed width and height and a word-full layout includes:
s601: the web page display component judges whether a destination element with fixed width and height exists in the web page to be displayed through the description of the text (CSS) style of the HTML document. If at least one element is defined as a fixed width and height in the description of the CSS style of the HTML document, the webpage display component determines that a target element with the fixed width and height exists in the webpage to be displayed. If no element is defined as the fixed width and height in the description of the CSS style of the HTML document, the web page display component determines that the destination element of the fixed width and height does not exist in the web page to be displayed, and the flow goes to step S609. The destination elements include text boxes, title bars, tool bars, menu bars, text, and the like.
S602: if the target elements with fixed width and height exist in the webpage to be displayed, the webpage display component coarsens the characters corresponding to the CSS style, and performs first typesetting on the webpage to be displayed according to the coarsened characters.
S603: the webpage display component obtains character size information in the target element and size information of a container of the target element in the webpage typeset for the first time. The character size information includes size information of a section formed by all characters in the target element. The size information may be width information, height information, and/or size information, etc. For example, as shown in fig. 7, the target element is a toolbar, and the text in the toolbar includes "file", "edit", "view", and the section formed by all the text in the toolbar is a region 701 surrounded by a broken line in fig. 7.
S604: the webpage display component judges whether the characters overflow in the target elements according to the size information of the containers of the target elements in the webpage typeset for the first time and the character size information in the target elements. If the character size information in the target element in the webpage typeset for the first time is larger than the size information of the container of the target element, the webpage display component determines that the characters overflow in the target element. If the text size information in the target element in the first typeset web page is smaller than or equal to the size information of the container of the target element, the web page display component determines that the text does not overflow in the target element, and the flow jumps to step S609.
S605: and if the text overflows in the target element, the webpage display component performs second typesetting on the webpage to be displayed according to the font thickness coefficient corresponding to the CSS style.
S606: the webpage display component obtains the text size information in the target element and the size information of the container of the target element in the webpage typeset for the second time.
S607: the webpage display component judges whether the characters are fully paved with the target elements according to the size information of the containers of the target elements in the webpage typeset for the second time and the character size information in the target elements. If the difference between the character size information in the target element in the webpage typeset for the second time and the size information of the container of the target element is smaller than the preset size, the webpage display component determines that the characters are fully paved with the target element. If the difference between the size information of the text in the target element and the size information of the container of the target element in the second typeset web page is greater than or equal to the preset size, the web page display component determines that the text is not full of the target element, and the flow jumps to step S609.
S608: if the characters are full of the target elements, the webpage display component determines that the webpage to be displayed is a layout with fixed width and height and full of the characters. The webpage display component recognizes the scene of the webpage to be displayed as a sixth recognition scene according to the fifth scene rule according to the webpage loading request.
S609: the web page display component determines that the web page to be displayed is not a layout of fixed width and height and full text.
In some embodiments, the sixth scenario rule is to identify whether the web page to be displayed is a malicious web site or a risky web site. The seventh recognition scenario is that the web page to be displayed is a malicious web site or a risk web site. When the webpage display component loads the webpage, whether the website of the webpage to be displayed is a malicious website or a risk website can be judged through a local blacklist database embedded in the webpage and/or a blacklist database at a server side. The blacklist database records websites of various fraudulent, counterfeit, phishing or horse hanging webpages. In some embodiments, if the web address of the web page to be displayed matches a web address in the local web address blacklist database, the web page display component determines that the web address of the web page to be displayed is a malicious web address or a risk web address. The webpage display component recognizes the scene of the webpage to be displayed as a seventh recognition scene according to a sixth scene rule according to the webpage loading request. If the web address of the web page to be displayed is not matched with the web address in the local web address blacklist database, the web page display component determines that the web address of the web page to be displayed is not a malicious web address or a risk web address according to a sixth scene rule according to the web page loading request.
In some embodiments, the web page display component may also send the web address of the web page to be displayed to the server for query when loading the web page. If the server determines that the website of the webpage to be displayed is matched with the website in the blacklist database of the server side, the server sends the matching result to the webpage display component, and the webpage display component can determine that the website of the webpage to be displayed is a malicious website or a risk website according to the matching result. The webpage display component recognizes the scene of the webpage to be displayed as a seventh recognition scene according to a sixth scene rule according to the webpage loading request. If the server determines that the web address of the web page to be displayed is not matched with the web address in the blacklist database of the server side, the server sends the unmatched result to the web page display component, and the web page display component can determine that the web address of the web page to be displayed is not a malicious web address or a risk web address according to the unmatched result.
In some embodiments, the web page display component may further perform scene recognition on the web page to be displayed according to the order of priority of the scene rule from high to low according to the web page loading request when the scene rule meets the preset condition, where the order of priority of the scene rule from high to low may be: the first, second, third, fourth, fifth, sixth, and seventh scene rules are as shown in fig. 8.
In fig. 8, the web page display component first performs scene recognition on the web page to be displayed according to the first scene rule. If the webpage display component recognizes that the webpage to be displayed defines the font thickness of the automatic following system in the meta tag, the webpage display component performs scene recognition on the webpage to be displayed according to the second scene rule. If the webpage display component detects that the text of the webpage to be displayed does not use online fonts or mixed fonts, the webpage display component performs scene recognition on the webpage to be displayed according to a third scene rule. If the webpage display component identifies that the webpage to be displayed is not the multi-text page, the webpage display component carries out scene identification on the webpage to be displayed according to a fourth scene rule. If the webpage display component identifies that the webpage to be displayed is not a webpage set by a plurality of different font weights (font-weight), the webpage display component performs scene identification on the webpage to be displayed according to a fifth scene rule. If the webpage display component identifies that the webpage to be displayed is not of a layout with fixed width and height and full characters, the webpage display component performs scene identification on the webpage to be displayed according to a sixth scene rule. If the webpage display component recognizes that the webpage to be displayed is not a malicious website and a risk website, namely if the webpage display component completes recognition according to all scene rules, the webpage display component recognizes that the scene of the webpage to be displayed is an eighth recognition scene. The eighth recognition scene is a scene in which the webpage to be displayed defines the font thickness of the automatic following system in the meta tag, and the webpage to be displayed is not the second recognition scene, the third recognition scene, the fourth recognition scene, the fifth recognition scene, the sixth recognition scene and the seventh recognition scene.
It is understood that other variations of the priority levels of the scene rules are possible, such as the priority levels of the second scene rule, the third scene rule, the fourth scene rule, the fifth scene rule, and the sixth scene rule are in other orders from high to low, which is not limited in this application.
It is understood that the scene rules may include at least two of the first scene rule, the second scene rule, the third scene rule, the fourth scene rule, the fifth scene rule, and the sixth scene rule described above, and not all scene rules need to be included, which is not limited in this application.
S506: the web page display component updates the cache of the web page display component based on the identified scene.
In some embodiments, the web page display component determines whether the web page to be displayed adjusts the font thickness of the web page according to the font thickness coefficient of the system based on the identified scene, and updates the cache of the web page display component according to the determination result. If the identified scene indicates that the webpage to be displayed does not need to adjust the font thickness of the webpage according to the font thickness coefficient of the system, the webpage display component generates a system font file according to the font thickness style of the webpage to be displayed and the default font thickness coefficient of the webpage to be displayed, and the system font file is newly added to the cache of the webpage display component. The system font file may be a typeface file, which is a file of a set of one or more fonts. The system font file is used for drawing font objects of the character fonts. In some embodiments, the first, third, fifth, sixth, and seventh recognition scenes indicate that the web page to be displayed does not need to adjust the font size of the web page according to the font size coefficients of the system.
If the identified scene indicates that the webpage to be displayed needs to adjust the font thickness of the webpage according to the font thickness coefficient of the system, the webpage display component adjusts the system font file according to the font thickness style of the webpage to be displayed and the font thickness coefficient corresponding to the system style information, and the adjusted system font file is newly added to the cache of the webpage display component. In some embodiments, the web page display component also saves the system font file prior to adjusting the system font file. The system font file in the cache of the web page display component and the adjusted system font file do not overlap each other. The second scene, the fourth scene, and the eighth scene are the webpages to be displayed, and the font thickness of the webpages needs to be adjusted according to the font thickness coefficient of the system.
S507: and the webpage display component performs typesetting rendering on the webpage to be displayed based on the identified scene.
In some embodiments, if the identified scene indicates that the webpage to be displayed does not need to adjust the font thickness of the webpage according to the font thickness coefficient of the system, the webpage display component performs typesetting rendering on the webpage to be displayed by using the system font file in the cache of the webpage display component, that is, the webpage display component displays the webpage to be displayed according to the default font thickness coefficient of the webpage to be displayed.
In some embodiments, if the identified scene indicates that the webpage to be displayed needs to adjust the font thickness of the webpage according to the font thickness coefficient of the system, the webpage display component performs typesetting rendering on the webpage to be displayed by using the adjusted system font file in the cache of the webpage display component, that is, the webpage display component displays the webpage to be displayed according to the font thickness coefficient of the system.
S508: the web page display component presents the typeset rendered page.
S509: the system server informs the application program of a font thickness coefficient adjustment event corresponding to the text style of the system.
The system server is a system server of a system application framework layer. The font thickness coefficient adjustment event corresponding to the system style information may be started by the system server based on a second operation of the user, for example, based on an operation of a font thickness option in a system setting of the terminal device by the user, and the system server may notify the application program of the font thickness coefficient adjustment event corresponding to the text style of the application program system through view. And the webpage is not reconstructed by the font thickness coefficient adjustment event corresponding to the text style of the declaration system in the configuration file of the application program.
S510: and the application program sets the font thickness coefficient corresponding to the text style of the adjusted system into the webpage display component according to the notification.
In some embodiments, the application may notify the web page display component system of the font thickness coefficient adjustment event corresponding to the text style by view. The webpage display component obtains a fontvolghtScale value corresponding to a new text style after a user changes the text style of the system from the system server through an interface opened by the system, namely a font thickness coefficient corresponding to the new text style. In some embodiments, the system open interface is a Configuration #fontscale object.
S511: the webpage display component synchronizes font thickness coefficients corresponding to the new text style after the user changes the text style of the system to a rendering engine of the webpage display component.
The rendering engine of the webpage display component can acquire font thickness coefficients corresponding to the new text style after the user changes the text style of the system from the webpage display component, so that the webpage display component can finish synchronizing the font thickness coefficients corresponding to the new text style after the user changes the text style of the system to the rendering engine of the webpage display component.
S512: the web page display component determines whether to update a cache of the web page display component based on the identified scene.
The web page display component may determine whether to update the cache of the web page display component based on the identified context based on the user's return to the original page. In this embodiment, the web page display component may determine, based on the identified scene, whether the web page to be displayed adjusts the font thickness of the web page according to the new font thickness coefficient after the system is changed, and accordingly determine whether to update the cache of the web page display component.
In some embodiments, if the identified scene indicates that the webpage to be displayed does not need to adjust the font size of the webpage according to the new font size coefficient after the system is changed, the webpage display component does not update the cache of the webpage display component. The first scene, the third scene, the fifth scene, the sixth scene and the seventh scene indicate that the webpage to be displayed does not need to adjust the font thickness of the webpage according to the new font thickness coefficient after the system is changed.
In some embodiments, if the identified scene indicates that the webpage to be displayed needs to adjust the font size of the webpage according to the new font size coefficient after the system is changed, the webpage display component determines that the font file corresponding to the font size coefficient corresponding to the new text style after the text style of the system is changed cannot be found in the cache of the webpage display component, and adjusts the system font file according to the font size coefficient corresponding to the new text style after the text style of the system is changed by the user. The second scene, the fourth scene and the eighth scene indicate that the webpage to be displayed needs to adjust the font thickness of the webpage according to the new font thickness coefficient after the system is changed.
In some embodiments, the system modified adjusted system font file overlays the system font file before the system modification but does not overlay the system font file in the cache of the web page display component.
S513: and the webpage display component displays the webpage to be displayed according to the determination result.
In some embodiments, if the web page display component does not update the cache of the web page display component, the web page display component does not perform typesetting rendering on the web page to be displayed again, and displays the web page to be displayed according to the system font file, that is, the web page display component displays the web page to be displayed according to the default font thickness coefficient of the web page to be displayed.
If the webpage display component updates the cache of the webpage display component, the webpage display component performs typesetting rendering on the webpage to be displayed again according to the adjusted system font file after the user changes the text style of the system, and displays the webpage to be displayed according to the adjusted system font file, namely, the webpage display component adjusts the font thickness of the webpage to be displayed according to the font thickness coefficient corresponding to the new text style after the user changes the text style of the system.
Fig. 9 is a schematic process diagram of a web page display method according to an embodiment of the present application. The application may load and display web pages through embedded Webview components. After the application program is started, the Webview component can identify the scene of the webpage to be displayed, determine whether to update the cache of the Webview component according to the identified scene, and typesetting and rendering the webpage to be displayed. A system service (system server) may drive the Webview component to load and display web pages. The Webview component may obtain, through a system server of the system application framework layer, font thickness coefficients corresponding to the new text style after the user changes the text style of the system. Specifically, when receiving an operation of a font thickness option in a system setting of a terminal device by a user, the system server records the font thickness parameter corresponding to a new text style after the user changes the text style of the system into a system environment variable (Property). The system environment variable (Property) is an Android Property mechanism and contains all system attributes. Each system environment variable (Property) is organized into simple key-value pairs for external use. The system server informs the Webview component system of the font thickness coefficient adjustment event corresponding to the text style through the onconfiguration changed. After the Webview component monitors a font thickness coefficient adjustment event corresponding to the text style of the system, the font thickness coefficient corresponding to the new text style after the user changes the text style of the system is read from a system environment variable (Property). After the Webview component obtains the font thickness coefficient corresponding to the new text style after the user changes the text style of the system, the Webview component can determine whether to update the cache of the Webview component according to the identified scene of the webpage to be displayed, and correspondingly display the webpage to be displayed.
It can be understood that the web page display method can be applied to not only the first page (initial page) visible to the user after the application program is run, but also the first target page jumped from the initial page and the second target page jumped from the first target page, which is not limited in this application. The application of the web page display method to the first target page jumped from the initial page may be, for example, after step S508, the application program may resend the web page load request to the web page display component, where the resent web page load request may be based on the user selection operation (e.g., clicking operation) of the control in the presented page, and the web page display component will continue to execute according to the steps of steps S505 to S508 described above. The process of applying the web page display method to the second target page jumped from the first target page is similar to the process of applying the web page display method to the first target page jumped from the initial page, and will not be described herein.
It can be understood that, when the first target page is jumped to from the initial page or the second target page is jumped to from the first target page, in step S512, if the identified scene indicates that the webpage to be displayed needs to be adjusted in font thickness according to the new font thickness coefficient after the system is changed, and the webpage display component determines that the font file corresponding to the font thickness coefficient corresponding to the new text style after the user changes the text style of the system exists in the cache of the webpage display component, the webpage display component does not update the cache of the webpage display component. If the identified scene indicates that the webpage to be displayed needs to adjust the font thickness of the webpage according to the new font thickness coefficient after the system is changed, and the webpage display component determines that the font file corresponding to the font thickness coefficient corresponding to the new text style after the user changes the text style of the system does not exist in the cache of the webpage display component, the webpage display component adjusts the system font file according to the font thickness coefficient corresponding to the new text style after the user changes the text style of the system.
It will be appreciated that before step S501, the steps are further included: the system server receives the operation of the user on the font thickness option in the system setting of the terminal device, and the font thickness information in the system style information in step S502 may be the font thickness coefficient corresponding to the new text style after the user changes the text style of the system, which is not limited in this application.
It is understood that after step S503, the web page display method may execute steps S509-S511 first, then execute steps S504-S508, and omit steps S512-S514, which is not limited in this application.
It is understood that the web page display component may also be initialized each time a new web page is created, and the application program is not required to be started in step S501, which is not limited in this application.
It can be appreciated that step S505 in fig. 5 may be omitted, and the web page display component may adjust the font thickness of the web page to be displayed according to the font thickness coefficient of the system, and/or adjust the font thickness of the web page to be displayed according to the font thickness coefficient corresponding to the new text style after the user changes the text style of the system, which is not limited in this application. That is, the web page display component does not need to perform scene recognition any more, and accordingly, in step S506, the web page display component may adjust the system font file according to the font thickness coefficient corresponding to the system style information, and update the cache of the web page display component accordingly, and in step S507, the web page display component may use the adjusted system font file before system modification in the cache of the web page display component to typeset and render the web page; in step S512, the web page display component may adjust the system font file according to the font thickness coefficient corresponding to the new text style after the user changes the text style of the system, and correspondingly update the cache of the web page display component, and in step S513, the web page display component uses the adjusted system font file in the cache of the web page display component to typeset and render the web page.
It can be understood that the scene recognition function may be turned on or turned off according to the operation of the user, for example, before the step S512, the scene recognition function is not turned on, and when the step S512, the scene recognition function is turned on, if the recognized scene indicates that the webpage to be displayed does not need to adjust the font thickness of the webpage according to the new font thickness coefficient after the system is changed, the webpage display component may display the webpage to be displayed according to the font thickness coefficient corresponding to the text style before the system is changed, which is not limited in this application. Specifically, in step S513, if the web page display component does not update the cache of the web page display component, the web page display component may not perform typesetting rendering on the web page to be displayed again, and display the web page to be displayed according to the font file corresponding to the font thickness coefficient corresponding to the text style before the system is changed.
It can be understood that the above-mentioned webpage display method can be applied not only to a scene of one webpage to be displayed, but also to a scene of a plurality of webpages to be displayed, which is not limited in this application. One or more system font files corresponding to the web pages to be displayed can be stored in the cache of the web page display component. In the scene of a plurality of webpages to be displayed, different webpages to be displayed can respectively determine whether the font thickness of the webpages needs to be adjusted according to the font thickness coefficient of the system, and the webpages to be displayed are correspondingly displayed.
For example, after the system server notifies the application program of a font size coefficient adjustment event corresponding to a text style of the system, the application program may send a first web page loading request to the web page display component, and the web page display component may identify a scene of a first web page to be displayed according to the first web page loading request, and identify that the first web page to be displayed uses an online font. The webpage display component determines that the font thickness of the webpage does not need to be adjusted according to the font thickness coefficient of the system, performs typesetting rendering on the first webpage to be displayed by using the system font file, and displays the typeset rendered first webpage.
The application program may further send a second web page loading request to the web page display component, and the web page display component may identify a scene of the second web page to be displayed according to the second web page loading request, and identify the second web page to be displayed as a multi-text page. The webpage display component determines that the second webpage to be displayed needs to adjust the font thickness of the webpage according to the font thickness coefficient of the system, if the font file corresponding to the font thickness coefficient corresponding to the new text style after the user changes the text style of the system does not exist in the cache of the webpage display component, the webpage display component adjusts the system font file according to the font thickness coefficient corresponding to the new text style after the user changes the text style of the system, covers the adjusted system font file before the system is changed by the adjusted system font file after the system is changed, and performs typesetting rendering on the second webpage to be displayed by using the adjusted system font file after the system is changed, and displays the typesetting rendered second webpage. If a font file corresponding to a font thickness coefficient corresponding to a new text style after the user changes the text style of the system exists in the cache of the webpage display component, the webpage display component directly uses the font file corresponding to the font thickness coefficient corresponding to the new text style after the user changes the text style of the system to typeset and render the second webpage to be displayed, and displays the typeset and rendered second webpage.
It can be understood that, in the context of multiple webpages to be displayed, before the system server notifies the application program of the font thickness coefficient adjustment event corresponding to the text style of the system, the webpage display component may display the first webpage to be displayed and/or the second webpage to be displayed, and identify the first webpage to be displayed and/or the second webpage to be displayed, so that after the system is changed, it is not necessary to identify the context of the first webpage to be displayed and the context of the second webpage to be displayed.
It can be understood that, in the above two scenarios, the web page display method can not only adjust font thickness, but also adjust text style, which is not limited in this application. Specifically, when the text style is adjusted, the webpage display component obtains the text style corresponding to the system style information in the initializing process; the webpage display component synchronizes a text style corresponding to the system style information to a rendering engine of the webpage display component; the method comprises the steps that when a webpage display component recognizes a scene of a webpage to be displayed, a first recognition scene is that the webpage to be displayed defines a text pattern which does not follow a system in a meta tag, a second recognition scene is that the webpage to be displayed defines a text pattern which follows the system in the meta tag, a fifth recognition scene is that the webpage to be displayed is a webpage with a plurality of different font (font) setting pairs, and the recognized scene is used for indicating whether the webpage to be displayed adjusts the text of the webpage according to the new text pattern after system change; when the webpage to be displayed is displayed before the system is changed, displaying the webpage to be displayed according to the font file corresponding to the acquired text style or displaying the webpage to be displayed according to the font file corresponding to the default system text style of the webpage to be displayed; when the system notifies the webpage display component, the text style adjustment event of the system is notified; when the webpage display components are synchronized, synchronizing a new text style after the user changes the text style of the system; when the webpage to be displayed is displayed after the system is changed, displaying the webpage to be displayed for a font file corresponding to a new text style after the system is changed according to the acquired user text style, or displaying the webpage to be displayed according to a font file corresponding to a default system text style of the webpage to be displayed.
Fig. 10 is a schematic logic structure diagram of a web page display device according to an embodiment of the present application. The web page display device 100 is applied to the terminal equipment. The web page display device 100 includes an acquisition module 1001, a display module 1002, a storage module 1003, and a scene recognition module 1004.
In some embodiments, the obtaining module 1001 is configured to obtain a first font thickness coefficient corresponding to the system style information, where the first font thickness coefficient is a font thickness coefficient corresponding to a new text style after the user changes the text style of the system. The display module 1002 is configured to adjust a font size of a web page to be displayed according to the first font size coefficient.
In some embodiments, the obtaining module 1001 is configured to obtain the first font thickness coefficient through a system server of a system application framework layer.
In some embodiments, the first font size factor is a font size factor adjustment event notification obtained from the system server based on a user operation.
In some embodiments, the display module 1002 is configured to adjust a system font file according to the first font thickness coefficient; and adjusting the font thickness of the webpage to be displayed according to the adjusted system font file.
In some embodiments, the storage module 1003 is configured to save the system font file.
In some embodiments, the scene recognition module 1004 is configured to recognize a scene of the webpage to be displayed, where the scene is configured to indicate whether the webpage to be displayed adjusts a font size of the webpage according to the new font size coefficient after the system modification. The display module 1002 is configured to adjust the font thickness of the web page to be displayed according to the first font thickness coefficient if the scene indicates that the web page to be displayed needs to be adjusted according to the new font thickness coefficient after the system is changed.
In some embodiments, the display module 1002 is further configured to display the webpage to be displayed according to the second font thickness coefficient if the scene indicates that the webpage to be displayed does not need to adjust the font thickness of the webpage according to the new font thickness coefficient after the system modification.
In some embodiments, the second font thickness coefficient is a font thickness coefficient corresponding to the text style before the system is changed, or the second font thickness coefficient is a default font thickness coefficient of the web page to be displayed.
Fig. 11 is a schematic diagram of a logic structure of another web page display device according to an embodiment of the present application. The web page display device 110 is applied to the terminal device. The web page display device 110 includes a scene recognition module 1101 and a processing module 1102.
In some embodiments, the scene recognition module 1101 is configured to recognize a scene of a web page to be displayed, where the scene is configured to indicate whether the web page to be displayed adjusts a text of the web page according to a new text style after a system change. The processing module 1102 is configured to obtain a first text style corresponding to the system style information if the scene indicates that the webpage to be displayed needs to adjust a text style of the webpage according to the new text style after the system is changed, and adjust the text style of the webpage to be displayed according to the first text style, where the first text style is the new text style after the user changes the text style of the system. The processing module 1102 is further configured to display the web page to be displayed according to the second text style if the scene indicates that the web page to be displayed does not need to adjust the text style of the web page according to the new text style after the system is changed.
In some embodiments, the text style includes one or more of the following: font, font thickness, font color, font position, font shape, font effect, or font size.
In some embodiments, the first scene indicates that the webpage to be displayed does not need to adjust the text style of the webpage according to the new text style after the system is changed, and the first scene satisfies one or more of the following situations: the method comprises the steps that a text style which does not follow a system is defined in a meta tag, the text of the webpage to be displayed uses online fonts or mixed fonts, the webpage to be displayed is a plurality of pages with different fonts, the webpage to be displayed is of a layout with fixed width and height and full characters, or the webpage to be displayed is a malicious website or a risk website.
In some embodiments, a second scene indicates that the webpage to be displayed needs to adjust the text style of the webpage according to the new text style after the system is changed, the second scene satisfying one or more of the following conditions: and defining a text style of a following system in the meta tag, or defining the webpage to be displayed as a multi-text page.
In addition to the above method and the terminal device, the embodiments of the present application also provide a computer-readable storage medium storing a program that causes a computer device to execute the above web page display method.
A computer program product comprising computer-executable instructions stored in a computer-readable storage medium; at least one processor of the device may read the computer-executable instructions from the computer-readable storage medium, the at least one processor executing the computer-executable instructions causing the device to implement the web page display method described above.
According to the webpage typesetting method and device, after the font thickness coefficient corresponding to the system style information is adjusted, the font thickness of the webpage to be displayed can be adjusted according to the font thickness coefficient corresponding to the new text style after the user changes the text style of the system, so that the webpage can follow the system font thickness, and the problem that the webpage cannot follow the system font thickness and cause negative webpage typesetting experience is solved.
From the above description of the embodiments, it will be apparent to those skilled in the art that the present application may be implemented by means of software plus necessary general purpose hardware, or of course may be implemented by dedicated hardware including application specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components and the like. Generally, functions performed by computer programs can be easily implemented by corresponding hardware, and specific hardware structures for implementing the same functions can be varied, such as analog circuits, digital circuits, or dedicated circuits. However, a software program implementation is a preferred embodiment in many cases for the present application. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a readable storage medium, such as a floppy disk, a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk or an optical disk of a computer, etc., including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform the method described in the embodiments of the present application.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., a floppy Disk, a hard Disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a Solid State Disk (SSD)), or the like.
Finally, it should be noted that the above embodiments are merely for illustrating the technical solution of the present application and not for limiting, and although the present application has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solution of the present application may be modified or substituted without departing from the spirit and scope of the technical solution of the present application.

Claims (15)

1. A web page display method applied to a terminal device, the method comprising:
acquiring a first font thickness coefficient corresponding to system style information, wherein the first font thickness coefficient is a font thickness coefficient corresponding to a new text style after a user changes the text style of the system;
and adjusting the font thickness of the webpage to be displayed according to the first font thickness coefficient.
2. The method of claim 1, wherein the obtaining the first font thickness coefficient corresponding to the system style information comprises:
and acquiring the first font thickness coefficient through a system server of a system application framework layer.
3. The method of claim 2, wherein the first font size factor is a font size factor adjustment event notification obtained from the system server according to a user operation performed after the system server obtains the first font size factor.
4. A method according to any one of claims 1-3, wherein said adjusting the font size of the web page to be displayed according to the first font size factor comprises:
adjusting a system font file according to the first font thickness coefficient;
and adjusting the font thickness of the webpage to be displayed according to the adjusted system font file.
5. The method of claim 4, wherein prior to said adjusting a system font file according to said first font weight coefficient, said method further comprises:
and storing the system font file.
6. The method of any one of claims 1-5, wherein the method further comprises:
identifying a scene of the webpage to be displayed, wherein the scene is used for indicating whether the webpage to be displayed adjusts the font thickness of the webpage according to the new font thickness coefficient after the system is changed;
the adjusting the font thickness of the webpage to be displayed according to the first font thickness coefficient comprises:
and if the scene indicates that the webpage to be displayed needs to adjust the font thickness of the webpage according to the new font thickness coefficient after the system is changed, adjusting the font thickness of the webpage to be displayed according to the first font thickness coefficient.
7. The method of claim 6, wherein the method further comprises:
and if the scene indicates that the webpage to be displayed does not need to adjust the font thickness of the webpage according to the new font thickness coefficient after the system is changed, displaying the webpage to be displayed according to the second font thickness coefficient.
8. The method of claim 7, wherein the second font size coefficient is a font size coefficient corresponding to a text style before the system is changed or the second font size coefficient is a default font size coefficient of the web page to be displayed.
9. A web page display method applied to a terminal device, the method comprising:
identifying a scene of a webpage to be displayed, wherein the scene is used for indicating whether the webpage to be displayed adjusts the text of the webpage according to a new text style after system modification;
if the scene indicates that the webpage to be displayed needs to adjust the text style of the webpage according to the new text style after the system is changed, acquiring a first text style corresponding to the system style information, and adjusting the text style of the webpage to be displayed according to the first text style, wherein the first text style is the new text style after the user changes the text style of the system;
And if the scene indicates that the webpage to be displayed does not need to adjust the text style of the webpage according to the new text style after the system is changed, displaying the webpage to be displayed according to the second text style.
10. The method of claim 9, wherein the text style comprises one or more of: font, font thickness, font color, font position, font shape, font effect, or font size.
11. The method of any of claims 9-10, wherein a first scene indicates that the web page to be displayed does not require adjustment of a text style of the web page according to a new text style after system modification, the first scene satisfying one or more of: the method comprises the steps that a text style which does not follow a system is defined in a meta tag, the text of the webpage to be displayed uses online fonts or mixed fonts, the webpage to be displayed is a plurality of pages with different fonts, the webpage to be displayed is of a layout with fixed width and height and full characters, or the webpage to be displayed is a malicious website or a risk website.
12. The method of any of claims 9-11, wherein a second scene indicates that the web page to be displayed requires adjustment of a text style of the web page according to a new text style after system modification, the second scene satisfying one or more of: and defining a text style of a following system in the meta tag, or defining the webpage to be displayed as a multi-text page.
13. A terminal device comprising a processor, a memory and a computer program stored on the memory and executable by the processor, characterized in that the processor implements the web page display method according to any one of claims 1 to 8 or 9 to 12 when executing the computer program.
14. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a program that causes a terminal device to execute the web page display method according to any one of claims 1 to 8 or claims 9 to 12.
15. A computer program product comprising computer instructions which, when executed by one or more processors, implement the method of displaying a web page as claimed in any one of claims 1 to 8 or 9 to 12.
CN202111372338.6A 2021-11-18 2021-11-18 Webpage display method and terminal equipment Pending CN116136890A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111372338.6A CN116136890A (en) 2021-11-18 2021-11-18 Webpage display method and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111372338.6A CN116136890A (en) 2021-11-18 2021-11-18 Webpage display method and terminal equipment

Publications (1)

Publication Number Publication Date
CN116136890A true CN116136890A (en) 2023-05-19

Family

ID=86332725

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111372338.6A Pending CN116136890A (en) 2021-11-18 2021-11-18 Webpage display method and terminal equipment

Country Status (1)

Country Link
CN (1) CN116136890A (en)

Similar Documents

Publication Publication Date Title
US11403364B2 (en) Method and terminal device for extracting web page content
US20190251143A1 (en) Web page rendering method and related device
US8707164B2 (en) Integrated document viewer
US9697183B2 (en) Client side page processing
US8910036B1 (en) Web based copy protection
US20210149842A1 (en) System and method for display of document comparisons on a remote device
US8522132B2 (en) Widget behavior customization via cascaded style sheets
CN106716351B (en) Method and electronic equipment for displaying webpage
US9766860B2 (en) Dynamic source code formatting
CN107533568B (en) System and method for determining application zoom level
US20150234798A1 (en) System and method for changing a web ui application appearance based on state through css selector cascading
CA3155636C (en) Dynamic typesetting
Bader et al. Responsive web design techniques
CN114218890A (en) Page rendering method and device, electronic equipment and storage medium
CN113655999A (en) Rendering method, device and equipment of page control and storage medium
US10747943B2 (en) Method, device, client apparatus, and electronic device for presenting webpages
CN106575303B (en) Method and device for displaying webpage
CN111783007A (en) Display rendering method and device, electronic equipment and storage medium
CN111143749A (en) Webpage display method, device, equipment and storage medium
CN116136890A (en) Webpage display method and terminal equipment
CN115114556A (en) Method and device for creating page
RU2634221C2 (en) Method and device for drawing presentation of electronic document on screen
US11354379B2 (en) Display control method and display control apparatus
CN104978181B (en) Page display method, terminal and device
CN115438282B (en) Method and device for positioning elements in page

Legal Events

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