-// File: OpenGl_Display_1.cxx
-// Created: 25 October 2011
-// Author: Sergey ZERCHANINOV
-// Copyright: OPEN CASCADE 2011
-
+// Created on: 2011-10-25
+// Created by: Sergey ZERCHANINOV
+// Copyright (c) 2011-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+#include <InterfaceGraphic.hxx>
#include <OpenGl_Display.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_HAsciiString.hxx>
#include <OpenGl_FontMgr.hxx>
-
+#include <OpenGl_PrinterContext.hxx>
#include <OpenGl_AspectText.hxx>
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#ifdef HAVE_GL2PS
#include <gl2ps.h>
#endif
{
const char * EnumName;
const char * FontName;
- OSD_FontAspect FontAspect;
+ Font_FontAspect FontAspect;
};
static const FontMapNode myFontMap[] =
#ifdef WNT
- { "Courier" , "Courier New" , OSD_FA_Regular },
- { "Times-Roman" , "Times New Roman", OSD_FA_Regular },
- { "Times-Bold" , "Times New Roman", OSD_FA_Bold },
- { "Times-Italic" , "Times New Roman", OSD_FA_Italic },
- { "Times-BoldItalic" , "Times New Roman", OSD_FA_BoldItalic },
- { "ZapfChancery-MediumItalic", "Script" , OSD_FA_Regular },
- { "Symbol" , "Symbol" , OSD_FA_Regular },
- { "ZapfDingbats" , "WingDings" , OSD_FA_Regular },
- { "Rock" , "Arial" , OSD_FA_Regular },
- { "Iris" , "Lucida Console" , OSD_FA_Regular }
+ { "Courier" , "Courier New" , Font_FA_Regular },
+ { "Times-Roman" , "Times New Roman", Font_FA_Regular },
+ { "Times-Bold" , "Times New Roman", Font_FA_Bold },
+ { "Times-Italic" , "Times New Roman", Font_FA_Italic },
+ { "Times-BoldItalic" , "Times New Roman", Font_FA_BoldItalic },
+ { "ZapfChancery-MediumItalic", "Script" , Font_FA_Regular },
+ { "Symbol" , "Symbol" , Font_FA_Regular },
+ { "ZapfDingbats" , "WingDings" , Font_FA_Regular },
+ { "Rock" , "Arial" , Font_FA_Regular },
+ { "Iris" , "Lucida Console" , Font_FA_Regular }
#else //X11
- { "Courier" , "Courier" , OSD_FA_Regular },
- { "Times-Roman" , "Times" , OSD_FA_Regular },
- { "Times-Bold" , "Times" , OSD_FA_Bold },
- { "Times-Italic" , "Times" , OSD_FA_Italic },
- { "Times-BoldItalic" , "Times" , OSD_FA_BoldItalic },
- { "Arial" , "Helvetica" , OSD_FA_Regular },
- { "ZapfChancery-MediumItalic", "-adobe-itc zapf chancery-medium-i-normal--*-*-*-*-*-*-iso8859-1" , OSD_FA_Regular },
- { "Symbol" , "-adobe-symbol-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific" , OSD_FA_Regular },
- { "ZapfDingbats" , "-adobe-itc zapf dingbats-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific" , OSD_FA_Regular },
- { "Rock" , "-sgi-rock-medium-r-normal--*-*-*-*-p-*-iso8859-1" , OSD_FA_Regular },
- { "Iris" , "--iris-medium-r-normal--*-*-*-*-m-*-iso8859-1" , OSD_FA_Regular }
+ { "Courier" , "Courier" , Font_FA_Regular },
+ { "Times-Roman" , "Times" , Font_FA_Regular },
+ { "Times-Bold" , "Times" , Font_FA_Bold },
+ { "Times-Italic" , "Times" , Font_FA_Italic },
+ { "Times-BoldItalic" , "Times" , Font_FA_BoldItalic },
+ { "Arial" , "Helvetica" , Font_FA_Regular },
+ { "ZapfChancery-MediumItalic", "-adobe-itc zapf chancery-medium-i-normal--*-*-*-*-*-*-iso8859-1" , Font_FA_Regular },
+ { "Symbol" , "-adobe-symbol-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific" , Font_FA_Regular },
+ { "ZapfDingbats" , "-adobe-itc zapf dingbats-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific" , Font_FA_Regular },
+ { "Rock" , "-sgi-rock-medium-r-normal--*-*-*-*-p-*-iso8859-1" , Font_FA_Regular },
+ { "Iris" , "--iris-medium-r-normal--*-*-*-*-m-*-iso8859-1" , Font_FA_Regular }
#endif
};
/*-----------------------------------------------------------------------------*/
-int OpenGl_Display::FindFont (const char* AFontName, const OSD_FontAspect AFontAspect,
+int OpenGl_Display::FindFont (const char* AFontName, const Font_FontAspect AFontAspect,
const int ABestSize, const float AXScale, const float AYScale)
{
if (!AFontName)
// The last resort: trying to use ANY font available in the system
if ( myFont == -1 )
{
- myFont = mgr->request_font( family_name, OSD_FA_Undefined, -1 );
+ myFont = mgr->request_font( family_name, Font_FA_Undefined, -1 );
}
if ( myFont != -1 )
myNewStr (0),
myStrPtr (&theStr[0])
{
- const Standard_Integer aStrLen = wcslen(theStr); // Length of the original string
+ const Standard_Integer aStrLen = (Standard_Integer) wcslen(theStr); // Length of the original string
Standard_Integer aNextCRChar = 0; // Character after '\r' (Carriage Return) '\x00\x0D'
Standard_Integer aHTNum = 0; // Number of '\t' (Horizontal Tabulation) '\x00\x09'
Standard_Integer aDumpNum = 0; // Number of '\a', '\b', '\v' and '\f'
if( !aspect->IsZoomable() )
{
+#ifdef WNT
+ // if the context has assigned printer context, use it's parameters
+ OpenGl_PrinterContext* aPrinterContext =
+ OpenGl_PrinterContext::GetPrinterContext( GET_GL_CONTEXT() );
+ if( aPrinterContext )
+ {
+ // get printing scaling in x and y dimensions
+ GLfloat aTextScalex = 1, aTextScaley = 1;
+ aPrinterContext->GetScale( aTextScalex, aTextScaley );
+
+ // text should be scaled in all directions with same
+ // factor to save its proportions, so use height (y) scaling
+ // as it is better for keeping text/3d graphics proportions
+ glScalef( aTextScaley, aTextScaley, aTextScaley );
+ }
+#endif
glScaled( h, h, h );
}
else