PDA

View Full Version : Extracting fonts boundary in 2D vector point



sydjung
7th October 2011, 04:06
Hi guys, I am new to QT. I was wondering if there is a way to get windows font boundary in x, y coordinate using QT.

ChrisW67
7th October 2011, 04:56
What is a "windows font boundary"?

sydjung
7th October 2011, 06:00
hi, thnx for ur replying. i mean i need to extract outline of a letter (including inner/outer points in x, y coordinates)

ChrisW67
7th October 2011, 23:26
There's no way to do this in Qt that I am aware of. Bitmap fonts have no outline as such, just pixels that are on or off. TrueType/OpenType/Postscript Type 1 fonts are described as a mathematical path to trace but each does it differently, and the x/y coordinates don't exist until it is rendered at a certain size on a certain device. To extract the outline from an outline font would be format specific.

In general terms you could get an outline by rendering a character and running an edge detection algorithm on the bitmap.

QFontMetrics and QFontMetricsF provide a range of measurements of a font which may help.

wysota
8th October 2011, 08:42
You probably could use QPainterPath::addText() to get the outline, however extracting coordinates from that outline will probably be close to impossible.

bobbell
27th February 2015, 05:11
I am testing 2d barcode font (http://www.keepautomation.com/qrcode/) of Word (http://www.keepautomation.com/products/word_barcode/barcodes/qrcode.html) document.Not sure if this would be the correct placement of this thread, but seen the question asked before in here.
How do I add my two QTextLayouts to the QTextDocument? I've tried to use QTextDocument.setDocumentLayout(), but this takes a QAbstractTextDocument as argument.