inline GLuint upload_tex(psi_rndr::TextureData const& tex) { GLuint tex_handle; gl::GenTextures(1, &tex_handle); gl::BindTexture(gl::TEXTURE_2D, tex_handle); auto width = tex.width; auto height = tex.height; for (size_t i_lvl = 0; i_lvl < tex.data.size(); ++i_lvl) { gl::TexImage2D( gl::TEXTURE_2D, i_lvl, tex_internal_format(tex.encoding), width, height, 0, tex_format(tex.encoding), tex_type(tex.encoding), tex.data[i_lvl].data() ); width /= 2; height /= 2; } return tex_handle; }
void set_alt_gettext_mode (PRN *prn) { gettext_mode = GETTEXT_DEFAULT; /* As of 2014-09-07, we'll handle RTF by (a) getting gettext to write UTF-8 (forcing it if necessary) then (b) using utf8_to_rtf() to convert to ASCII plus \uXXXX codes, as per the spec for RTF >= 1.5. (It would be nice if gettext were able to generate the latter directly, but it can't.) Note: this means that RTF should not be written to file directly: a bufferized PRN should be used first so that the buffer can be sent through utf8_to_rtf(); then it can be written to file. */ if (prn != NULL && !native_utf8) { if (gretl_in_gui_mode()) { if (printing_to_standard_stream(prn)) { gettext_mode = GETTEXT_FORCE_LOCALE; } } else if (tex_format(prn) || rtf_format(prn)) { /* CLI mode, writing TeX or RTF */ gettext_mode = GETTEXT_FORCE_UTF8; } } }
void gretl_prn_newline (PRN *prn) { if (tex_format(prn)) { pputs(prn, "\\\\\n"); } else if (rtf_format(prn)) { pputs(prn, "\\par\n"); } else { pputc(prn, '\n'); } }