RenderText and Chrome UI text drawing
来源:互联网 发布:音响频谱软件 编辑:程序博客网 时间:2024/05/29 04:51
Most text in Chrome’s UI is rendered either through gfx::Canvas text drawing facilities or by using gfx::RenderText directly. Indeed, gfx::Canvas itself uses gfx::RenderText for drawing and measuring text, so that nearly all UI text drawn in Chrome Windows and ChromeOS ends up going through gfx::RenderText.
gfx::RenderText has platform-specific subclasses for shaping text runs using platform APIs: Uniscribe on Windows, Pango on Linux + ChromeOS and CoreText on the Mac. Although the shaping/layout code is platform-specific, drawing the text uses a common path, using Skia. The gfx::RenderText subclasses also share common implementations of the various effects that can be applied to the text such as fading and shadows, as well as the more rudimentary settings such as text alignment.
In addition to text layout, each gfx::RenderText subclass also performs any necessary selection of fallback fonts needed to render particular runs of text. While this is mostly delegated to Pango on Linux and CoreText on the Mac, the Windows implementation has to do this work itself through the font linking information from the registry.
gfx::RenderText is a stateful API - an instance of a gfx::RenderText subclass will cache its layout information between draw calls. Because of this, it is often more efficient to use the gfx::RenderText API directly instead of using a state-less abstraction such as the gfx::Canvas drawing calls. In particular, for text that changes rarely but that may be drawn multiple times, it is more efficient to keep an instance of gfx::RenderText around, so that the text layout would be performed only when the text is updated and not on every draw operation. Prior to the introduction of gfx::RenderText, this pattern was not possible, so you may see existing code still doing its text drawing through gfx::Canvas text drawing APIs (which in the past were not based on gfx::RenderText).
gfx::RenderText is also used to render footers and headers in printed page. This works because Skia has a PDF backend so that the glyph drawing calls done by gfx::RenderText are appropriately transformed to PDF output. This is currently the case on Mac OS X and Windows, but not yet Linux or ChromeOS because of sandboxing issues.
gfx::RenderText has platform-specific subclasses for shaping text runs using platform APIs: Uniscribe on Windows, Pango on Linux + ChromeOS and CoreText on the Mac. Although the shaping/layout code is platform-specific, drawing the text uses a common path, using Skia. The gfx::RenderText subclasses also share common implementations of the various effects that can be applied to the text such as fading and shadows, as well as the more rudimentary settings such as text alignment.
In addition to text layout, each gfx::RenderText subclass also performs any necessary selection of fallback fonts needed to render particular runs of text. While this is mostly delegated to Pango on Linux and CoreText on the Mac, the Windows implementation has to do this work itself through the font linking information from the registry.
gfx::RenderText is a stateful API - an instance of a gfx::RenderText subclass will cache its layout information between draw calls. Because of this, it is often more efficient to use the gfx::RenderText API directly instead of using a state-less abstraction such as the gfx::Canvas drawing calls. In particular, for text that changes rarely but that may be drawn multiple times, it is more efficient to keep an instance of gfx::RenderText around, so that the text layout would be performed only when the text is updated and not on every draw operation. Prior to the introduction of gfx::RenderText, this pattern was not possible, so you may see existing code still doing its text drawing through gfx::Canvas text drawing APIs (which in the past were not based on gfx::RenderText).
gfx::RenderText is also used to render footers and headers in printed page. This works because Skia has a PDF backend so that the glyph drawing calls done by gfx::RenderText are appropriately transformed to PDF output. This is currently the case on Mac OS X and Windows, but not yet Linux or ChromeOS because of sandboxing issues.
0 0
- RenderText and Chrome UI text drawing
- Drawing Anti-Aliased Text and Graphics:绘制反锯齿文字和图形
- Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.
- Drawing styled text with Uniscribe
- codeforces Bear and Drawing
- wpf Image and Drawing.Image
- UIView Drawing Cycle and ContentMode
- Drawing Simple Text:画简单的文本
- Drawing Rotated Text:画旋转字
- Part3:Drawing Text /用OpenGL 绘制文本
- Drawing Text(一)绘制文本
- Drawing
- Drawing horizontal and vertical gridlines for CListCtrl
- Flicker free drawing using GDI+ and C#
- iPhone Application Programming Guide - Graphics and Drawing
- creating and drawing on a new UIImage
- 绘制和填充(Drawing and Filling)
- Win32 Series - Drawing Dots and Lines
- 位运算 加减乘除 负值判断
- 用Java Socket开发小型服务器,支持上千个并发
- 使用Tornado进行网络异步编程
- Android如何使用Fragment构建动态界面
- bison -y -o "src\thrifty.cc" –defines="src/thrifty.hh"
- RenderText and Chrome UI text drawing
- Python的数据库ORM框架:SQLAlchemy
- Android两次后退键退出
- C# 输出参数的使用例子
- 这些细节还是应该注意的
- jquery中的数组过滤筛选-$.grep()
- O2O无缝营销 将独步天下
- java web中用request传递表单参数时字符编码设置
- UITabBarController 类似自定义效果的实现