Adaptive Text Scaling Using Cached Width and Font Data
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing adaptive text fixing methods require significant computational performance and are prone to calculation errors, leading to inconsistent performance across different sites during site expansion, thus decreasing efficiency.
Innovation Solution
A method that monitors content change events for text nodes, determines actual font information, calculates font size variation, and uses a scaling ratio formula to adaptively adjust text, reducing computational performance consumption and improving accuracy.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If boundary testing is used to obtain final text scaling value, then text scaling accuracy is improved, but computational performance consumption increases significantly
Solution Approach 1:
The patent pre-calculates and stores text width data in a cache during the initialization phase, before actual text rendering is needed. This preliminary action eliminates the need for repeated boundary testing during runtime, significantly reducing computational performance consumption while maintaining text scaling accuracy.
Solution Approach 2:
The patent creates a simplified copy of text width information that can be stored and reused without performing full boundary testing calculations. By copying and caching essential text measurement data, the system avoids repeated complex computations while preserving the accuracy needed for proper text scaling.
2Measurement precision
If boundary testing is used for adaptive text fixing, then text fixing accuracy is improved, but calculation errors increase due to numerous calculations
Solution Approach 1:
The patent performs text width measurements and stores results in advance, before actual text fixing is required. This preliminary calculation approach reduces the number of calculations needed during runtime, thereby reducing the likelihood of calculation errors while maintaining text fixing accuracy.
Solution Approach 2:
The patent implements a caching mechanism that provides feedback by storing previously calculated text width values. When the same text needs to be measured again, the cached value is retrieved instead of recalculating, reducing calculation errors and improving reliability.
3Adaptability or versatility
If fixing code is written for different online scenarios, then adaptability to various scenarios is improved, but device complexity increases
Solution Approach 1:
The patent implements a universal text measurement and caching mechanism that can handle multiple online scenarios through a single unified approach. Instead of writing separate fixing code for different scenarios, the system uses a general-purpose caching strategy that adapts to various text rendering situations, thereby reducing code complexity while maintaining scenario adaptability.
Solution Approach 2:
The patent adjusts text rendering parameters based on cached width information rather than using different fixing codes for different scenarios. By changing and reusing parameters like text width and scaling factors from the cache, the system achieves scenario adaptability with simpler, more consistent code.
4Measurement precision
If dozens of calculations are performed for single line of text, then text scaling precision is improved, but productivity decreases due to time consumption
Solution Approach 1:
The patent calculates and caches text width values in advance, before they are actually needed for text rendering or scaling. This preliminary calculation eliminates the need to perform dozens of calculations during runtime, significantly improving text processing efficiency while maintaining scaling precision through cached reference values.
Solution Approach 2:
The patent creates and stores copies of text measurement data that can be quickly retrieved and reused. Instead of performing repeated complex calculations for each text rendering operation, the system copies and uses pre-calculated width values from cache, dramatically improving productivity while preserving text scaling precision.
Data Source
AI summary
A text adjustment method includes monitoring content change events for each text node, if a content change event is detected, obtaining actual font information of the updated text in a text node where the content change event occurred, and determining an actual text width of the updated text based on the actual font information, determining a font size variation based on the actual font information and user-input expected configuration information, determining a target scaling ratio for the updated text based on the actual font information, the actual text width, the font size variation, and the expected configuration information. Efficient and convenient adaptive scaling and fixing of text is enabled, computational performance consumption is reduced, text fixing accuracy is improved, and, thus, the efficiency of site expansion is enhanced.


