简体   繁体   English

Pango容器周围的布局流(图像)

[英]Pango layout flow around container (image)

I'm using Pango for text layouting without the cairo backend (currently testing with the win32 backend). 我将Pango用于没有cairo后端的文本布局(当前正在使用win32后端进行测试)。 And I like to know if pango is capable of a flow layout around an image, or any given container. 而且我想知道pango是否能够围绕图像或任何给定的容器进行流布局。 Or maybe inside a custom container. 或者也许在自定义容器中。

Something like this: Flow around image 像这样: 围绕图像流动

I have checked many examples and the Pango API and didn't found such a feature. 我检查了许多示例和Pango API,却没有发现这种功能。 Maybe I'm missing something or Pango does not have this feature. 也许我丢失了某些东西,或者Pango没有此功能。

As I said in this answer , you can't. 就像我在这个答案中说的那样,您不能。 I went through the source code Pango graphics handling is primitive to the point of uselessness. 我遍历了源代码Pango图形处理是原始的,直到无用为止。 Unless there's been some major reworking in the past year, which the release notes don't indicate, it's probably the same now. 除非在过去的一年中进行了一些重大的修改(发行说明未指出),否则现在可​​能是相同的。

The image you provide as an example is only available as PDF at the moment which requires every line, word and glyph be hard-positioned on the page. 您作为示例提供的图像目前仅以PDF格式提供,这要求在页面上固定每行,每个单词和所有字形。 While theoretically possible to check the alpha channel of the image to wrap the text around the actual image instead of the block it contains, this has not (to the best of my knowledge) ever been implemented in a dynamic output system. 从理论上讲,可以检查图像的Alpha通道以将文本环绕实际图像而不是包含的图像,但据我所知,这从未在动态输出系统中实现过。

Pango, specifically, cannot even open "holes" in the text for graphics to be added later and, at the code level, doesn't even have the concept of a multi-line cell - hence a line being the size of its largest component. 具体来说,Pango甚至无法在文本中打开“孔”以供以后添加图形,并且在代码级甚至没有多行单元格的概念-因此,一行是其最大部分的大小。

Your best bet is to look at WebKit for more complex displays. 最好的选择是查看WebKit以获得更复杂的显示。 I, for one, have pretty much given up on Pango and it seems to be getting less popular. 我,其中一个,已经对Pango放弃了很多,它似乎越来越不受欢迎了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM