Skip to content
Snippets Groups Projects
Commit c05aed9e authored by Maxime Graulich's avatar Maxime Graulich
Browse files

iOS: fix font size on retina display

parent 0652a31f
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,7 @@
static bool locked = false;
static bool onelabStop = false;
drawContext::drawContext()
drawContext::drawContext(bool isRetina)
{
GmshInitialize();
GmshSetOption("General", "Terminal", 1.0);
......@@ -64,6 +64,7 @@ drawContext::drawContext()
_fillMesh = false;
_gradiant = true;
_fontFactor = (isRetina)?2:1;
}
static void checkGlError(const char* op) {
......@@ -478,10 +479,10 @@ void drawContext::drawScale()
else{
sprintf(label, "%s", data->getName().c_str());
}
drawString lbl(label, 20);
drawString lbl(label, 20*_fontFactor);
lbl.draw(xmin+width/2, ymin+ 2.5*dh, 0., _width/(_right-_left), _height/(_top-_bottom));
drawString val(data->getName().c_str(), 14);
drawString val(data->getName().c_str(), 14*_fontFactor);
for(int i = 0; i < 3; i++) {
double v = opt->getScaleValue(i, 3, opt->tmpMin, opt->tmpMax);
sprintf(label, opt->format.c_str(), v);
......@@ -536,11 +537,11 @@ void drawContext::drawAxes(float x0, float y0, float z0, float h)
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
double dx = h/10;
drawString x ("X", 14,colors);
drawString x ("X", 14*_fontFactor,colors);
x.draw(x0+h+dx, y0, z0, _width/(_right-_left), _height/(_top-_bottom), false);
drawString y("Y", 14,colors+8);
drawString y("Y", 14*_fontFactor,colors+8);
y.draw(x0+dx, y0+h, z0, _width/(_right-_left), _height/(_top-_bottom), false);
drawString z("Z", 14,colors+16);
drawString z("Z", 14*_fontFactor,colors+16);
z.draw(x0+dx, y0, z0+h, _width/(_right-_left), _height/(_top-_bottom), false);
glPopMatrix();
glLineWidth(1);
......
......@@ -35,6 +35,7 @@ private:
movePosition _start, _previous, _current; // store informations about user interactions
int _width, _height; // size of OpenGL context in pixel
float _left, _right, _top, _bottom; // value of "border"
float _fontFactor;
bool _gradiant, // show the background gradiant
_fillMesh; // fill the Mesh
......@@ -43,7 +44,7 @@ private:
void drawVectorArray(PViewOptions *opt, VertexArray *va);
public:
drawContext();
drawContext(bool isRetina=false);
~drawContext(){}
void load(std::string filename);
void eventHandler(int event, float x=0, float y=0);
......
......@@ -56,10 +56,10 @@ void drawString::draw(float x, float y, float z, float w, float h, bool center)
if(center)
x-=(float)_realWidth/w/2;
GLfloat vertex[] = {
x, y, z, // bottom left
x, y+(float)_height/h, z, // top left
x+(float)_width/w, y, z, // bottom right
x+(float)_width/w, y+(float)_height/h, z, // top right
x, y-_height/h+_size/h, z, // bottom left
x, y+(float)_height/h-_height/h+_size/h, z, // top left
x+(float)_width/w, y-_height/h+_size/h, z, // bottom right
x+(float)_width/w, y+(float)_height/h-_height/h+_size/h, z, // top right
};
GLfloat texture[] = {
0.0f, 1.0f, // top left
......
......@@ -54,7 +54,7 @@
//[self release];
return nil;
}
mContext = new drawContext();
mContext = new drawContext(eaglLayer.contentsScale==2);
}
rendering = NO;
return self;
......
......@@ -5,5 +5,5 @@ mkdir -p ios.iconset
convert -scale 152 ../../../utils/icons/gmsh_mobile_master.png ios.iconset/icon_app_ipad_retina.png
convert -scale 76 ../../../utils/icons/gmsh_mobile_master.png ios.iconset/icon_app_ipad.png
# App icons (iPhone)
# App icon (iPhone)
convert -scale 120 ../../../utils/icons/gmsh_mobile_master.png ios.iconset/icon_app_iphone_retina.png
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment