/** * Testing function. */ void LC_SimpleTests::slotTestUnicode() { RS_DEBUG->print("%s\n: begin\n", __func__); auto appWin= QC_ApplicationWindow::getAppWindow(); appWin->slotFileOpen("./fonts/unicode.cxf", RS2::FormatCXF); RS_Document* d =appWin->getDocument(); if (d) { RS_Graphic* graphic = (RS_Graphic*)d; if (graphic==NULL) { return; } RS_Insert* ins; int col; int row; QChar uCode; // e.g. 65 (or 'A') QString strCode; // unicde as string e.g. '[0041] A' graphic->setAutoUpdateBorders(false); for (col=0x0000; col<=0xFFF0; col+=0x10) { printf("col: %X\n", col); for (row=0x0; row<=0xF; row++) { //printf(" row: %X\n", row); uCode = QChar(col+row); //printf(" code: %X\n", uCode.unicode()); strCode.setNum(uCode.unicode(), 16); while (strCode.length()<4) { strCode="0"+strCode; } strCode = "[" + strCode + "] " + uCode; if (graphic->findBlock(strCode)) { RS_InsertData d(strCode, RS_Vector(col/0x10*20.0,row*20.0), RS_Vector(1.0,1.0), 0.0, 1, 1, RS_Vector(0.0, 0.0), NULL, RS2::NoUpdate); ins = new RS_Insert(graphic, d); ins->setLayerToActive(); ins->setPen(RS_Pen(RS_Color(255, 255, 255), RS2::Width01, RS2::SolidLine)); ins->update(); graphic->addEntity(ins); } } } graphic->setAutoUpdateBorders(true); graphic->calculateBorders(); } RS_DEBUG->print("%s\n: end\n", __func__); }