1fe7144a07
This introduces a way to trace each entry in the glyph index array to a specific index in the original text passed to QTextLayout, as well as a convenience function to access the original string from the QGlyphRun. The index information is stored in the logClusters array internally in Qt, but it contains the inverse information: For each character in the output string, it contains an index into the glyph array. In order to get the string indexes for each glyph, which makes a lot more sense in the context of the QGlyphRun API, we need to do a little search to construct the data. To avoid adding unnecessary allocations, we make the new APIs opt-in. If you do not specify anything, you will only get the glyph indexes and glyph positions as before. However, you can now specify exactly which parts of the layout to extract using an optional flags parameter. This also adds a manual test which can be very handy to visualize QTextLayouts and how they are split into QGlyphRuns. Fixes: QTBUG-103932 Change-Id: Ie4288fff338b9482aba0aba29fc7e1e59fa60900 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
201 lines
5.0 KiB
XML
201 lines
5.0 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<ui version="4.0">
|
|
<class>Controller</class>
|
|
<widget class="QWidget" name="Controller">
|
|
<property name="geometry">
|
|
<rect>
|
|
<x>0</x>
|
|
<y>0</y>
|
|
<width>549</width>
|
|
<height>419</height>
|
|
</rect>
|
|
</property>
|
|
<property name="windowTitle">
|
|
<string>Form</string>
|
|
</property>
|
|
<layout class="QVBoxLayout" name="verticalLayout">
|
|
<item>
|
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
<item>
|
|
<widget class="QLabel" name="label">
|
|
<property name="text">
|
|
<string>Source string:</string>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<widget class="QPlainTextEdit" name="teSourceString"/>
|
|
</item>
|
|
</layout>
|
|
</item>
|
|
<item>
|
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
<item>
|
|
<widget class="QCheckBox" name="cbWrap">
|
|
<property name="text">
|
|
<string>Wrap</string>
|
|
</property>
|
|
<property name="checked">
|
|
<bool>true</bool>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<widget class="QFontComboBox" name="fcbFont"/>
|
|
</item>
|
|
</layout>
|
|
</item>
|
|
<item>
|
|
<widget class="QGroupBox" name="gbRange">
|
|
<property name="title">
|
|
<string>Range</string>
|
|
</property>
|
|
<property name="checkable">
|
|
<bool>true</bool>
|
|
</property>
|
|
<property name="checked">
|
|
<bool>false</bool>
|
|
</property>
|
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
<item>
|
|
<widget class="QLabel" name="label_2">
|
|
<property name="text">
|
|
<string>From</string>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<widget class="QSpinBox" name="sbFrom"/>
|
|
</item>
|
|
<item>
|
|
<widget class="QLabel" name="label_3">
|
|
<property name="text">
|
|
<string>To</string>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<widget class="QSpinBox" name="sbTo"/>
|
|
</item>
|
|
<item>
|
|
<spacer name="horizontalSpacer_2">
|
|
<property name="orientation">
|
|
<enum>Qt::Horizontal</enum>
|
|
</property>
|
|
<property name="sizeHint" stdset="0">
|
|
<size>
|
|
<width>40</width>
|
|
<height>20</height>
|
|
</size>
|
|
</property>
|
|
</spacer>
|
|
</item>
|
|
</layout>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<widget class="QGroupBox" name="groupBox">
|
|
<property name="title">
|
|
<string>Display</string>
|
|
</property>
|
|
<layout class="QGridLayout" name="gridLayout">
|
|
<item row="1" column="0">
|
|
<widget class="View" name="view" native="true">
|
|
<property name="sizePolicy">
|
|
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
|
<horstretch>0</horstretch>
|
|
<verstretch>0</verstretch>
|
|
</sizepolicy>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item row="0" column="0">
|
|
<widget class="QSlider" name="hsLineWidth">
|
|
<property name="minimum">
|
|
<number>1</number>
|
|
</property>
|
|
<property name="maximum">
|
|
<number>100</number>
|
|
</property>
|
|
<property name="value">
|
|
<number>100</number>
|
|
</property>
|
|
<property name="orientation">
|
|
<enum>Qt::Horizontal</enum>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item row="2" column="0">
|
|
<widget class="GlyphRunInspector" name="inspector" native="true">
|
|
<property name="sizePolicy">
|
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
|
<horstretch>0</horstretch>
|
|
<verstretch>0</verstretch>
|
|
</sizepolicy>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
</layout>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
<item>
|
|
<spacer name="horizontalSpacer">
|
|
<property name="orientation">
|
|
<enum>Qt::Horizontal</enum>
|
|
</property>
|
|
<property name="sizeHint" stdset="0">
|
|
<size>
|
|
<width>40</width>
|
|
<height>20</height>
|
|
</size>
|
|
</property>
|
|
</spacer>
|
|
</item>
|
|
<item>
|
|
<widget class="QPushButton" name="pbQuit">
|
|
<property name="text">
|
|
<string>Quit</string>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
</layout>
|
|
</item>
|
|
</layout>
|
|
</widget>
|
|
<customwidgets>
|
|
<customwidget>
|
|
<class>View</class>
|
|
<extends>QWidget</extends>
|
|
<header>view.h</header>
|
|
<container>1</container>
|
|
</customwidget>
|
|
<customwidget>
|
|
<class>GlyphRunInspector</class>
|
|
<extends>QWidget</extends>
|
|
<header>glyphruninspector.h</header>
|
|
<container>1</container>
|
|
</customwidget>
|
|
</customwidgets>
|
|
<resources/>
|
|
<connections>
|
|
<connection>
|
|
<sender>pbQuit</sender>
|
|
<signal>clicked()</signal>
|
|
<receiver>Controller</receiver>
|
|
<slot>close()</slot>
|
|
<hints>
|
|
<hint type="sourcelabel">
|
|
<x>517</x>
|
|
<y>398</y>
|
|
</hint>
|
|
<hint type="destinationlabel">
|
|
<x>35</x>
|
|
<y>-16</y>
|
|
</hint>
|
|
</hints>
|
|
</connection>
|
|
</connections>
|
|
</ui>
|