// Set up and initialize GLC void testApp::setupQuesoGlc() { ofSetVerticalSync(true); //ofSetFrameRate(60); //ofEnableAlphaBlending(); //ofEnableSmoothing(); //ofBackground(0, 0, 0); ctx = glcGenContext(); glcContext(ctx); // glcAppendCatalog(ofToDataPath("font").c_str()); glcAppendCatalog("/System/Library/Fonts"); font = glcGenFontID(); glcNewFontFromFamily(font, "Hiragino Mincho ProN"); glcFontFace(font, "W6"); glcFont(font); glcRenderStyle(GLC_TEXTURE); glcEnable(GLC_GL_OBJECTS); glcEnable(GLC_MIPMAP); glcEnable(GLC_HINTING_QSO); glcStringType(GLC_UTF8_QSO); }
static void iV_initializeGLC(void) { if (_glcContext) { return; } _glcContext = glcGenContext(); if (!_glcContext) { debug(LOG_ERROR, "Failed to initialize"); } else { debug(LOG_NEVER, "Successfully initialized. _glcContext = %d", (int)_glcContext); } glcContext(_glcContext); glcEnable(GLC_AUTO_FONT); // We *do* want font fall-backs glcRenderStyle(GLC_TEXTURE); glcStringType(GLC_UTF8_QSO); // Set GLC's string type to UTF-8 FIXME should be UCS4 to avoid conversions #ifdef WZ_OS_MAC { char resourcePath[PATH_MAX]; CFURLRef resourceURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); if (CFURLGetFileSystemRepresentation(resourceURL, true, (UInt8 *) resourcePath, PATH_MAX)) { sstrcat(resourcePath, "/Fonts"); glcAppendCatalog(resourcePath); } else { debug(LOG_ERROR, "Could not change to resources directory."); } if (resourceURL != NULL) { CFRelease(resourceURL); } } #endif _glcFont_Regular = glcGenFontID(); _glcFont_Bold = glcGenFontID(); if (!glcNewFontFromFamily(_glcFont_Regular, font_family)) { debug(LOG_ERROR, "Failed to select font family %s as regular font", font_family); } else { debug(LOG_NEVER, "Successfully selected font family %s as regular font", font_family); } if (!glcFontFace(_glcFont_Regular, font_face_regular)) { debug(LOG_WARNING, "Failed to select the \"%s\" font face of font family %s", font_face_regular, font_family); } else { debug(LOG_NEVER, "Successfully selected the \"%s\" font face of font family %s", font_face_regular, font_family); } if (!glcNewFontFromFamily(_glcFont_Bold, font_family)) { debug(LOG_ERROR, "iV_initializeGLC: Failed to select font family %s for the bold font", font_family); } else { debug(LOG_NEVER, "Successfully selected font family %s for the bold font", font_family); } if (!glcFontFace(_glcFont_Bold, font_face_bold)) { debug(LOG_WARNING, "Failed to select the \"%s\" font face of font family %s", font_face_bold, font_family); } else { debug(LOG_NEVER, "Successfully selected the \"%s\" font face of font family %s", font_face_bold, font_family); } debug(LOG_NEVER, "Finished initializing GLC"); }