Ignore:
Timestamp:
Nov 11, 1999, 12:31:22 AM (26 years ago)
Author:
phaller
Message:

Add: font remapping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gdi32/font.cpp

    r1697 r1699  
    1 /* $Id: font.cpp,v 1.3 1999-11-10 22:44:19 phaller Exp $ */
     1/* $Id: font.cpp,v 1.4 1999-11-10 23:30:45 phaller Exp $ */
    22
    33/*
     
    2525#include "unicode.h"
    2626#include <vmutex.h>
     27#include <heapstring.h>
     28#include <win\options.h>
    2729
    2830
     
    3436FONTENUMPROCA FontEnumProcWinA;
    3537FONTENUMPROCW FontEnumProcWinW;
     38
     39
     40/*****************************************************************************
     41 * Name      : static void iFontRename
     42 * Purpose   : font remapping table to map win32 fonts to OS/2 pendants
     43 * Parameters: LPSTR lpstrFaceOriginal - the win32 face name
     44 *             LPSTR lpstrFaceBuffer   - [LF_FACESIZE] buffer to new name
     45 * Variables :
     46 * Result    :
     47 * Remark    : remapped name is passed back in the buffer
     48 *             if no mapping pendant is available, return input parameter
     49 *             as default.
     50 * Status    :
     51 *
     52 * Author    : Patrick Haller [Fri, 1998/06/12 03:44]
     53 *****************************************************************************/
     54
     55#define ODINFONTSECTION "Font Mapping"
     56static void iFontRename(LPCSTR lpstrFaceOriginal,
     57                        LPSTR  lpstrFaceTemp)
     58{
     59  int   iRet;
     60
     61  // NULL is a valid parameter
     62  if (lpstrFaceOriginal == NULL)
     63     return;
     64
     65  memcpy(lpstrFaceTemp, lpstrFaceOriginal, LF_FACESIZE);
     66  strupr(lpstrFaceTemp);
     67
     68  //lookup table
     69  iRet = PROFILE_GetOdinIniString(ODINFONTSECTION,
     70                                  lpstrFaceTemp,
     71                                  lpstrFaceOriginal,
     72                                  lpstrFaceTemp,
     73                                  LF_FACESIZE);
     74}
     75
    3676
    3777//******************************************************************************
     
    5393               LPCSTR, lpszFace)
    5494{
    55   dprintf(("lpszFace = %s\n", lpszFace));
    56 
    57   return  O32_CreateFont(nHeight,
     95  CHAR  lpstrFaceNew[LF_FACESIZE];
     96  HFONT hFont;
     97
     98  iFontRename(lpszFace, lpstrFaceNew);
     99
     100  dprintf(("lpszFace = %s -> %s\n", lpszFace, lpstrFaceNew));
     101
     102  hFont = O32_CreateFont(nHeight,
    58103                         nWidth,
    59104                         nEscapement,
     
    68113                         fdwQuality,
    69114                         fdwPitchAndFamily,
    70                          lpszFace);
     115                         lpszFace != NULL ? lpstrFaceNew : NULL);
     116  return hFont;
    71117}
    72118//******************************************************************************
     
    120166//******************************************************************************
    121167//******************************************************************************
    122 HFONT WIN32API CreateFontIndirectA(const LOGFONTA *lplf)
    123 {
    124  HFONT rc;
    125 
    126     dprintf(("GDI32: CreateFontIndirectA\n"));
    127     dprintf(("GDI32: lfHeight        = %d\n", lplf->lfHeight));
    128     dprintf(("GDI32: lfWidth          = %d\n", lplf->lfWidth));
    129     dprintf(("GDI32: lfEscapement    = %d\n", lplf->lfEscapement));
    130     dprintf(("GDI32: lfOrientation   = %d\n", lplf->lfOrientation));
    131     dprintf(("GDI32: lfWeight        = %d\n", lplf->lfWeight));
    132     dprintf(("GDI32: lfItalic        = %d\n", lplf->lfItalic));
    133     dprintf(("GDI32: lfUnderline     = %d\n", lplf->lfUnderline));
    134     dprintf(("GDI32: lfStrikeOut     = %d\n", lplf->lfStrikeOut));
    135     dprintf(("GDI32: lfCharSet       = %X\n", lplf->lfCharSet));
    136     dprintf(("GDI32: lfOutPrecision  = %X\n", lplf->lfOutPrecision));
    137     dprintf(("GDI32: lfClipPrecision = %X\n", lplf->lfClipPrecision));
    138     dprintf(("GDI32: lfQuality       = %X\n", lplf->lfQuality));
    139     dprintf(("GDI32: lfPitchAndFamily= %X\n", lplf->lfPitchAndFamily));
    140     dprintf(("GDI32: lfFaceName      = %s\n", lplf->lfFaceName));
    141     rc = O32_CreateFontIndirect(lplf);
    142     dprintf(("GDI32: OS2CreateFontIndirectA returned %X\n", rc));
    143     return(rc);
     168ODINFUNCTION1(HFONT,CreateFontIndirectA,const LOGFONTA*, lplf)
     169{
     170  HFONT    hFont;
     171  LOGFONTA afont;
     172
     173  // don't touch user buffer!
     174  memcpy(&afont, lplf, sizeof(LOGFONTA));
     175  iFontRename(lplf->lfFaceName, afont.lfFaceName);
     176
     177  dprintf(("lpszFace = %s -> %s\n", lplf->lfFaceName, afont.lfFaceName));
     178
     179  dprintf(("GDI32: CreateFontIndirectA\n"));
     180  dprintf(("GDI32: lfHeight        = %d\n", lplf->lfHeight));
     181  dprintf(("GDI32: lfWidth          = %d\n", lplf->lfWidth));
     182  dprintf(("GDI32: lfEscapement    = %d\n", lplf->lfEscapement));
     183  dprintf(("GDI32: lfOrientation   = %d\n", lplf->lfOrientation));
     184  dprintf(("GDI32: lfWeight        = %d\n", lplf->lfWeight));
     185  dprintf(("GDI32: lfItalic        = %d\n", lplf->lfItalic));
     186  dprintf(("GDI32: lfUnderline     = %d\n", lplf->lfUnderline));
     187  dprintf(("GDI32: lfStrikeOut     = %d\n", lplf->lfStrikeOut));
     188  dprintf(("GDI32: lfCharSet       = %X\n", lplf->lfCharSet));
     189  dprintf(("GDI32: lfOutPrecision  = %X\n", lplf->lfOutPrecision));
     190  dprintf(("GDI32: lfClipPrecision = %X\n", lplf->lfClipPrecision));
     191  dprintf(("GDI32: lfQuality       = %X\n", lplf->lfQuality));
     192  dprintf(("GDI32: lfPitchAndFamily= %X\n", lplf->lfPitchAndFamily));
     193  dprintf(("GDI32: lfFaceName      = %s\n", lplf->lfFaceName));
     194
     195  hFont = O32_CreateFontIndirect(&afont);
     196
     197  return(hFont);
    144198}
    145199//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.