示例#1
0
static LRESULT
Display_OnCreate(HWND hwnd)
{
	DISPLAYDATA* pData;
	const int nSizes[MAX_SIZES] = {8, 12, 18, 24, 36, 48, 60, 72};
	int i;
	EXTLOGFONTW ExtLogFont = {{50, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
	                          ANSI_CHARSET, OUT_DEFAULT_PRECIS,
	                          CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
	                          DEFAULT_PITCH , L"Ms Shell Dlg"},
	                          L"Ms Shell Dlg"};

	/* Create data structure */
	pData = malloc(sizeof(DISPLAYDATA));
	ZeroMemory(pData, sizeof(DISPLAYDATA));

	/* Set the window's GWLP_USERDATA to our data structure */
	SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pData);

	for (i = 0; i < MAX_SIZES; i++)
	{
		pData->nSizes[i] = nSizes[i];
	}

	pData->hCaptionFont = CreateFontIndirectW(&ExtLogFont.elfLogFont);
	ExtLogFont.elfLogFont.lfHeight = 12;
	pData->hSizeFont = CreateFontIndirectW(&ExtLogFont.elfLogFont);

	Display_SetString(hwnd, (LPARAM)L"Jackdaws love my big sphinx of quartz. 1234567890");

	Display_SetTypeFace(hwnd, &ExtLogFont);

	return 0;
}
示例#2
0
void sFont2D::Init(const sChar *name,sInt size,sInt flags,sInt width)
{
  Exit();

  TEXTMETRIC tm;

  prv = new sFont2DPrivate;
  prv->Font=0;
  prv->BackPen = 0;

  if (name && name[0])
  {
    LOGFONTW log;
    sClear(log);
    log.lfHeight = size;
    log.lfWidth = width;
    log.lfCharSet = DEFAULT_CHARSET;
    if(flags & sF2C_BOLD)
      log.lfWeight = FW_BOLD;
    if(flags & sF2C_ITALICS)
      log.lfItalic = 1;
    if(flags & sF2C_UNDERLINE)
      log.lfUnderline = 1;
    if(flags & sF2C_STRIKEOUT)
      log.lfStrikeOut = 1;
    if(flags & sF2C_SYMBOLS)
      log.lfCharSet = SYMBOL_CHARSET;
    if(flags & sF2C_NOCLEARTYPE)
      log.lfQuality = ANTIALIASED_QUALITY;
    sCopyString(log.lfFaceName,name,LF_FACESIZE);
    prv->Font = CreateFontIndirectW(&log);
  }

  if (!prv->Font) // no font found -> get default Windows font
  {
    NONCLIENTMETRICS ncm;
    sClear(ncm);
    ncm.cbSize=sizeof(ncm);
    SystemParametersInfo(SPI_GETNONCLIENTMETRICS,sizeof(ncm),&ncm,0);
    prv->Font = CreateFontIndirectW(&ncm.lfMessageFont);
  }

  prv->BackColor = GDICOL(0xffffff);
  prv->TextColor = GDICOL(0x000000);

  // Get font metrics. must create a DC for this!
  HDC dc = GetDC(sHWND);
  HGDIOBJ oldfont = SelectObject(dc,prv->Font);
  GetTextMetricsW(dc,&tm);
  GetCharABCWidths(dc,0,NUMABC-1,prv->Widths);
  SelectObject(dc,oldfont);
  ReleaseDC(sHWND,dc);

  prv->Baseline = tm.tmAscent;
  prv->Height = tm.tmHeight;
  prv->CharHeight = tm.tmHeight - tm.tmInternalLeading;
}
示例#3
0
static LRESULT
Display_SetTypeFace(HWND hwnd, PEXTLOGFONTW pExtLogFont)
{
	DISPLAYDATA* pData;
	TEXTMETRIC tm;
	HDC hDC;
	RECT rect;
	SCROLLINFO si;
	int i;
	LOGFONTW logfont;

	/* Set the new type face name */
	pData = (DISPLAYDATA*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
	_snwprintf(pData->szTypeFaceName, LF_FULLFACESIZE, pExtLogFont->elfFullName);

	/* Create the new fonts */
	hDC = GetDC(hwnd);
	DeleteObject(pData->hCharSetFont);

	logfont = pExtLogFont->elfLogFont;
	logfont.lfHeight = -MulDiv(16, GetDeviceCaps(GetDC(NULL), LOGPIXELSY), 72);
	pData->hCharSetFont = CreateFontIndirectW(&logfont);

	/* Get font format */
	// FIXME: Get the real font format (OpenType?)
	SelectObject(hDC, pData->hCharSetFont);
	GetTextMetrics(hDC, &tm);
	if ((tm.tmPitchAndFamily & TMPF_TRUETYPE) == TMPF_TRUETYPE)
	{
		swprintf(pData->szFormat, L" (TrueType)");
	}

	for (i = 0; i < MAX_SIZES; i++)
	{
		DeleteObject(pData->hFonts[i]);
		logfont.lfHeight = -MulDiv(pData->nSizes[i], GetDeviceCaps(hDC, LOGPIXELSY), 72);
		pData->hFonts[i] = CreateFontIndirectW(&logfont);
	}

	/* Calculate new page dimensions */
	pData->nPageHeight = Display_DrawText(hDC, pData, 0);
	ReleaseDC(hwnd, hDC);

	/* Set the vertical scrolling range and page size */
	GetClientRect(hwnd, &rect);
	si.cbSize = sizeof(si);
	si.fMask  = SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS;
	si.nMin   = 0;
	si.nMax   = pData->nPageHeight;
	si.nPage  = rect.bottom;
	si.nPos   = 0;
	si.nTrackPos = 0;
	SetScrollInfo(hwnd, SB_VERT, &si, TRUE);

	return 0;
}
示例#4
0
static void LLabel_OnPaint(HWND hwnd)
{
	PAINTSTRUCT		ps;
	RECT			rc;
	int				state;
	HFONT			hFont;
	int				style = DT_SINGLELINE | DT_VCENTER;

	BeginPaint(hwnd, &ps);
	GetClientRect(hwnd, &rc);
	state = SaveDC(ps.hdc);
	SetBkMode(ps.hdc, TRANSPARENT);
	hFont = CreateFontIndirectW((LPLOGFONTW)GetWindowLongPtrW(hwnd, 4));
	SelectFont(ps.hdc, hFont);
	SetTextColor(ps.hdc, RGB(0, 0, 255));
	if(IsWindowUnicode(hwnd)){
		if(GetPropW(hwnd, LL_ALIGNW))
			style |= DT_RIGHT;
		else
			style |= DT_LEFT;
		DrawTextW(ps.hdc, (wchar_t *)GetWindowLongPtrW(hwnd, 0), -1, &rc, style);
	}
	else{
		if(GetProp(hwnd, LL_ALIGN))
			style |= DT_RIGHT;
		else
			style |= DT_LEFT;
		DrawText(ps.hdc, (char *)GetWindowLongPtr(hwnd, 0), -1, &rc, style);
	}
	RestoreDC(ps.hdc, state);
	DeleteFont(hFont);
	EndPaint(hwnd, &ps);
}
示例#5
0
static void SetLLTextW(HWND hwnd, wchar_t * lpText){
	wchar_t		* pText;
	SIZE		sz;
	HDC			hdc;
	int			state;
	HFONT		hFont;
	RECT		rc;

	GetWindowRect(hwnd, &rc);
	MapWindowPoints(HWND_DESKTOP, GetParent(hwnd), (LPPOINT)&rc, 2);
	pText = (wchar_t *)GetWindowLongPtrW(hwnd, 0);
	if(pText)
		free(pText);
	pText = (wchar_t *)calloc(wcslen(lpText) + 2, sizeof(wchar_t));
	wcscpy(pText, lpText);
	SetWindowLongPtrW(hwnd, 0, (LONG_PTR)pText);
	hdc = GetDC(hwnd);
	state = SaveDC(hdc);
	hFont = CreateFontIndirectW((LPLOGFONTW)GetWindowLongPtrW(hwnd, 4));
	SelectFont(hdc, hFont);
	GetTextExtentPoint32W(hdc, lpText, wcslen(lpText) + 1, &sz);
	RestoreDC(hdc, state);
	ReleaseDC(hwnd, hdc);
	DeleteFont(hFont);
	if(GetPropW(hwnd, LL_ALIGNW))
		SetWindowPos(hwnd, 0, rc.right - sz.cx, rc.top, sz.cx, sz.cy, SWP_SHOWWINDOW);
	else
		SetWindowPos(hwnd, 0, 0, 0, sz.cx, sz.cy, SWP_NOMOVE | SWP_SHOWWINDOW);
}
示例#6
0
文件: font.c 项目: Dietr1ch/wine
static void gdi_get_font_metrics(LOGFONTW *lf, struct font_metrics *fm)
{
    HDC hdc;
    HFONT hfont;
    NEWTEXTMETRICW ntm;
    OUTLINETEXTMETRICW otm;
    int ret;

    hdc = CreateCompatibleDC(0);

    /* it's the only way to get extended NEWTEXTMETRIC fields */
    ret = EnumFontFamiliesExW(hdc, lf, font_enum_proc, (LPARAM)&ntm, 0);
    ok(!ret, "EnumFontFamiliesExW failed to find %s\n", wine_dbgstr_w(lf->lfFaceName));

    hfont = CreateFontIndirectW(lf);
    SelectObject(hdc, hfont);

    otm.otmSize = sizeof(otm);
    ret = GetOutlineTextMetricsW(hdc, otm.otmSize, &otm);
    ok(ret, "GetOutlineTextMetrics failed\n");

    DeleteDC(hdc);
    DeleteObject(hfont);

    fm->lfHeight = -otm.otmTextMetrics.tmAscent;
    fm->line_spacing = ntm.ntmCellHeight;
    fm->font_size = (REAL)otm.otmTextMetrics.tmAscent;
    fm->font_height = (REAL)fm->line_spacing * fm->font_size / (REAL)ntm.ntmSizeEM;
    fm->em_height = ntm.ntmSizeEM;
    fm->ascent = ntm.ntmSizeEM;
    fm->descent = ntm.ntmCellHeight - ntm.ntmSizeEM;
}
示例#7
0
void
Test_CreateFontIndirectW(void)
{
    LOGFONTW logfont;
    HFONT hFont;
    ULONG ret;
    ENUMLOGFONTEXDVW elfedv2;

    logfont.lfHeight = 12;
    logfont.lfWidth = 0;
    logfont.lfEscapement = 0;
    logfont.lfOrientation = 0;
    logfont.lfWeight = FW_NORMAL;
    logfont.lfItalic = 0;
    logfont.lfUnderline = 0;
    logfont.lfStrikeOut = 0;
    logfont.lfCharSet = DEFAULT_CHARSET;
    logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
    logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
    logfont.lfQuality = PROOF_QUALITY;
    logfont.lfPitchAndFamily = DEFAULT_PITCH;
    memset(logfont.lfFaceName, 'A', LF_FACESIZE * 2);
    hFont = CreateFontIndirectW(&logfont);
    ok(hFont != 0, "CreateFontIndirectW failed\n");

    memset(&elfedv2, 0, sizeof(elfedv2));
    ret = GetObjectW(hFont, sizeof(elfedv2), &elfedv2);
    ok(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n");
    ok(elfedv2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == ((WCHAR)'A' << 8) + 'A', "\n");
    ok(elfedv2.elfEnumLogfontEx.elfFullName[0] == 0, "\n");
    /* Theres a bunch of data in elfFullName ... */
}
示例#8
0
static void draw_launchers( HDC hdc, RECT update_rect )
{
    COLORREF color = SetTextColor( hdc, RGB(255,255,255) ); /* FIXME: depends on background color */
    int mode = SetBkMode( hdc, TRANSPARENT );
    unsigned int i;
    LOGFONTW lf;
    HFONT font;

    SystemParametersInfoW( SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0 );
    font = SelectObject( hdc, CreateFontIndirectW( &lf ) );

    for (i = 0; i < nb_launchers; i++)
    {
        RECT dummy, icon = get_icon_rect( i ), title = get_title_rect( i );

        if (IntersectRect( &dummy, &icon, &update_rect ))
            DrawIconEx( hdc, icon.left, icon.top, launchers[i]->icon, icon_cx, icon_cy,
                        0, 0, DI_DEFAULTSIZE|DI_NORMAL );

        if (IntersectRect( &dummy, &title, &update_rect ))
            DrawTextW( hdc, launchers[i]->title, -1, &title,
                       DT_CENTER|DT_WORDBREAK|DT_EDITCONTROL|DT_END_ELLIPSIS );
    }

    SelectObject( hdc, font );
    SetTextColor( hdc, color );
    SetBkMode( hdc, mode );
}
示例#9
0
// Routine Description:
// - Add the font described by the LOGFONT structure to the font table if
//      it's not already there.
int
AddFont(
    ENUMLOGFONT *pelf,
    NEWTEXTMETRIC* /*pntm*/,
    int /*nFontType*/,
    HDC hDC)
{
    wil::unique_hfont hfont(CreateFontIndirectW(&pelf->elfLogFont));
    RETURN_LAST_ERROR_IF_NULL(hfont);

    hfont.reset(SelectFont(hDC, hfont.release()));

    TEXTMETRIC tm;
    GetTextMetricsW(hDC, &tm);

    SIZE sz;
    GetTextExtentPoint32W(hDC, L"0", 1, &sz);

    wprintf(L"  Actual Size: (X: %d, Y: %d)\r\n", sz.cx, tm.tmHeight + tm.tmExternalLeading);

    // restore original DC font
    hfont.reset(SelectFont(hDC, hfont.release()));

    return CONTINUE_ENUM;
}
示例#10
0
HFONT WINAPI HookCreateFontA(int cHeight, int cWidth, int cEscapement, int cOrientation, int cWeight, DWORD bItalic, DWORD bUnderline, __in DWORD bStrikeOut, __in DWORD iCharSet, __in DWORD iOutPrecision, __in DWORD iClipPrecision, DWORD iQuality, DWORD iPitchAndFamily, LPCSTR pszFaceName)
{
    LOGFONTW lf;

    lf.lfHeight         = cHeight;
    lf.lfWidth          = cWidth;
    lf.lfEscapement     = cEscapement;
    lf.lfOrientation    = cOrientation;
    lf.lfWeight         = cWeight;
    lf.lfItalic         = (BYTE)bItalic;
    lf.lfUnderline      = (BYTE)bUnderline;
    lf.lfStrikeOut      = (BYTE)bStrikeOut;
    lf.lfOutPrecision   = (BYTE)iOutPrecision;
    lf.lfClipPrecision  = (BYTE)iClipPrecision;
    lf.lfQuality        = CLEARTYPE_QUALITY;
    lf.lfPitchAndFamily = (BYTE)iPitchAndFamily;

    if (iCharSet == SHIFTJIS_CHARSET && g_TextTable != NULL)
    {
        iCharSet = GB2312_CHARSET;
        CopyStruct(lf.lfFaceName, L"SIMHEI", sizeof(L"SIMHEI"));
    }
    else
    {
        AnsiToUnicode(lf.lfFaceName, countof(lf.lfFaceName), pszFaceName);
    }

    lf.lfCharSet = (BYTE)iCharSet;

    return CreateFontIndirectW(&lf);
}
示例#11
0
文件: CRbFont.cpp 项目: Shy07/SINRGE2
/**
 *	@call
 *		Font.new						-> font	对象。
 *		Font.new(font_name) 			-> font 对象。
 *		Font.new(font_name, font_size) 	-> font 对象。
 *
 *	@desc
 *		创建一个字体对象。
 */
VALUE CRbFont::initialize(int argc, VALUE * argv, VALUE obj)
{
	//	检查参数个数
	if(argc > 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);

	//	检查参数有效性
	if(argc > 0) SafeStringValue(argv[0]);
	if(argc > 1) SafeFontSetSize(argv[1]);

	//	初始化默认属性
	m_name			= rb_obj_dup(argc > 0 ? argv[0] : dm_get_default_name(rb_cFont));
	m_size			= argc > 1 ? argv[1] : dm_get_default_size(rb_cFont);
	m_bold			= dm_get_default_bold(rb_cFont);
	m_italic		= dm_get_default_italic(rb_cFont);
	m_shadow		= dm_get_default_shadow(rb_cFont);

	VALUE __argv[1]	= { ULONG2NUM(GetObjectPtr<CRbColor>(__default_color__)->GetColor()) };
	VALUE color		= rb_class_new_instance(1, __argv, rb_cColor);//CRbColor::dm_clone(dm_get_default_color(rb_cFont));
	m_color_ptr		= GetObjectPtr<CRbColor>(color);
	
	//	创建逻辑字体
	m_lfw.lfHeight = FIX2INT(m_size);
	m_lfw.lfItalic = (BYTE)RTEST(m_italic);
	m_lfw.lfWeight = RTEST(m_bold) ? FW_BOLD : FW_NORMAL;
	wcscpy_s(m_lfw.lfFaceName, Kconv::UTF8ToUnicode(RSTRING_PTR(m_name)));

	m_hFont = CreateFontIndirectW(&m_lfw);

	return obj;
}
示例#12
0
void TabsCtrl::drawTab( HDC hdc, int offset, TabInfoRef tab, bool active ) {
    offset+=tab->tabXPos;
    int top=(active)? 0:1;
    RECT r={offset, top, offset+tab->tabWidth, tabHeight};
    FillRect(hdc, &r, (HBRUSH)GetStockObject((active)? WHITE_BRUSH : LTGRAY_BRUSH ));

    HGDIOBJ old=SelectObject(hdc, GetStockObject(BLACK_PEN));
    MoveToEx(hdc, offset, tabHeight, NULL);
    LineTo(hdc,offset,top);
    LineTo(hdc,offset+tab->tabWidth, top);
    LineTo(hdc,offset+tab->tabWidth,tabHeight);
    SelectObject(hdc, old);

    SetBkMode(hdc, TRANSPARENT);
    r.left+=2; r.right-=2; r.top+=1;
    const ODR * odr=tab->wndChild->getODR();
    if (odr) {
        odr->draw(hdc, r,0);
	} else {
		strcpy((char*)FONT_TABS.lfFaceName, "Tahoma"); 
		FONT_TABS.lfHeight = 11; 
		FONT_TABS.lfWidth = 5; 
		FONT_TABS.lfWeight = 800;
		FONT_TABS.lfItalic = false; 
		FONT_TABS.lfStrikeOut = false; 
		FONT_TABS.lfUnderline = false; 
		FONT_TABS.lfOrientation = 0; 
		FONT_TABS.lfEscapement = 0; 
		HFONT NormalFont  = CreateFontIndirectW(&FONT_TABS); 
		SelectObject(hdc, NormalFont); 
          DrawText(hdc, tab->wndChild->getWindowTitle(), -1, &r, DT_LEFT | DT_SINGLELINE | DT_END_ELLIPSIS );
	    DeleteObject(NormalFont);
	}
}
static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused)
{
    static const int states[] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL };

    RECT bgRect, textRect, contentRect;
    int state = states[ drawState ];
    WCHAR *text = get_button_text(hwnd);
    LOGFONTW lf;
    HFONT font, hPrevFont = NULL;
    BOOL created_font = FALSE;

    HRESULT hr = GetThemeFont(theme, hDC, BP_GROUPBOX, state, TMT_FONT, &lf);
    if (SUCCEEDED(hr)) {
        font = CreateFontIndirectW(&lf);
        if (!font)
            TRACE("Failed to create font\n");
        else {
            hPrevFont = SelectObject(hDC, font);
            created_font = TRUE;
        }
    } else {
        font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
        hPrevFont = SelectObject(hDC, font);
    }

    GetClientRect(hwnd, &bgRect);
    textRect = bgRect;

    if (text)
    {
        SIZE textExtent;
        GetTextExtentPoint32W(hDC, text, lstrlenW(text), &textExtent);
        bgRect.top += (textExtent.cy / 2);
        textRect.left += 10;
        textRect.bottom = textRect.top + textExtent.cy;
        textRect.right = textRect.left + textExtent.cx + 4;

        ExcludeClipRect(hDC, textRect.left, textRect.top, textRect.right, textRect.bottom);
    }

    GetThemeBackgroundContentRect(theme, hDC, BP_GROUPBOX, state, &bgRect, &contentRect);
    ExcludeClipRect(hDC, contentRect.left, contentRect.top, contentRect.right, contentRect.bottom);

    if (IsThemeBackgroundPartiallyTransparent(theme, BP_GROUPBOX, state))
        DrawThemeParentBackground(hwnd, hDC, NULL);
    DrawThemeBackground(theme, hDC, BP_GROUPBOX, state, &bgRect, NULL);

    SelectClipRgn(hDC, NULL);

    if (text)
    {
        InflateRect(&textRect, -2, 0);
        DrawThemeText(theme, hDC, BP_GROUPBOX, state, text, lstrlenW(text), 0, 0, &textRect);
        HeapFree(GetProcessHeap(), 0, text);
    }

    if (created_font) DeleteObject(font);
    if (hPrevFont) SelectObject(hDC, hPrevFont);
}
示例#14
0
static HFONT CreateBoldWindowFont(Window wnd)
{
	HFONT hFont = wnd.GetFont();
	LOGFONTW font = { 0 };
	::GetObject(hFont, sizeof(font), &font);
	font.lfWeight = FW_BOLD;
	return CreateFontIndirectW(&font); 
}
示例#15
0
static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate)
{
    IPADDRESS_INFO *infoPtr;
    RECT rcClient, edit;
    int i, fieldsize;
    HFONT hFont, hSysFont;
    LOGFONTW logFont, logSysFont;

    TRACE("\n");

    SetWindowLongW (hwnd, GWL_STYLE,
		    GetWindowLongW(hwnd, GWL_STYLE) & ~WS_BORDER);

    infoPtr = heap_alloc_zero (sizeof(*infoPtr));
    if (!infoPtr) return -1;
    SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);

    GetClientRect (hwnd, &rcClient);

    fieldsize = (rcClient.right - rcClient.left) / 4;

    edit.top    = rcClient.top + 2;
    edit.bottom = rcClient.bottom - 2;

    infoPtr->Self = hwnd;
    infoPtr->Enabled = TRUE;
    infoPtr->Notify = lpCreate->hwndParent;

    hSysFont = GetStockObject(ANSI_VAR_FONT);
    GetObjectW(hSysFont, sizeof(LOGFONTW), &logSysFont);
    SystemParametersInfoW(SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
    lstrcpyW(logFont.lfFaceName, logSysFont.lfFaceName);
    hFont = CreateFontIndirectW(&logFont);

    for (i = 0; i < 4; i++) {
	IPPART_INFO* part = &infoPtr->Part[i];

	part->LowerLimit = 0;
	part->UpperLimit = 255;
        edit.left = rcClient.left + i*fieldsize + 6;
        edit.right = rcClient.left + (i+1)*fieldsize - 2;
        part->EditHwnd =
		CreateWindowW (WC_EDITW, NULL, WS_CHILD | WS_VISIBLE | ES_CENTER,
                               edit.left, edit.top, edit.right - edit.left,
			       edit.bottom - edit.top, hwnd, (HMENU) 1,
			       (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL);
        SendMessageW(part->EditHwnd, WM_SETFONT, (WPARAM) hFont, FALSE);
	SetPropW(part->EditHwnd, IP_SUBCLASS_PROP, hwnd);
        part->OrigProc = (WNDPROC)
		SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC,
				(DWORD_PTR)IPADDRESS_SubclassProc);
        EnableWindow(part->EditHwnd, infoPtr->Enabled);
    }

    IPADDRESS_UpdateText (infoPtr);

    return 0;
}
示例#16
0
文件: font.c 项目: JamieYan/wine
static void test_GetMetrics(void)
{
    IDWriteGdiInterop *interop;
    DWRITE_FONT_METRICS metrics;
    OUTLINETEXTMETRICW otm;
    IDWriteFont *font;
    LOGFONTW logfont;
    HRESULT hr;
    HDC hdc;
    HFONT hfont;
    int ret;

    hr = IDWriteFactory_GetGdiInterop(factory, &interop);
    EXPECT_HR(hr, S_OK);

    memset(&logfont, 0, sizeof(logfont));
    logfont.lfHeight = 12;
    logfont.lfWidth  = 12;
    logfont.lfWeight = FW_NORMAL;
    logfont.lfItalic = 1;
    lstrcpyW(logfont.lfFaceName, tahomaW);

    hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
    ok(hr == S_OK, "got 0x%08x\n", hr);

    hfont = CreateFontIndirectW(&logfont);
    hdc = CreateCompatibleDC(0);
    SelectObject(hdc, hfont);

    otm.otmSize = sizeof(otm);
    ret = GetOutlineTextMetricsW(hdc, otm.otmSize, &otm);
    ok(ret, "got %d\n", ret);
    DeleteDC(hdc);
    DeleteObject(hfont);

    if (0) /* crashes on native */
        IDWriteFont_GetMetrics(font, NULL);

    memset(&metrics, 0, sizeof(metrics));
    IDWriteFont_GetMetrics(font, &metrics);

    ok(metrics.designUnitsPerEm != 0, "designUnitsPerEm %u\n", metrics.designUnitsPerEm);
    ok(metrics.ascent != 0, "ascent %u\n", metrics.ascent);
    ok(metrics.descent != 0, "descent %u\n", metrics.descent);
    todo_wine
    ok(metrics.lineGap == 0, "lineGap %d\n", metrics.lineGap);
    ok(metrics.capHeight, "capHeight %u\n", metrics.capHeight);
    ok(metrics.xHeight != 0, "xHeight %u\n", metrics.xHeight);
    ok(metrics.underlinePosition < 0, "underlinePosition %d\n", metrics.underlinePosition);
    ok(metrics.underlineThickness != 0, "underlineThickness %u\n", metrics.underlineThickness);
    ok(metrics.strikethroughPosition > 0, "strikethroughPosition %d\n", metrics.strikethroughPosition);
    ok(metrics.strikethroughThickness != 0, "strikethroughThickness %u\n", metrics.strikethroughThickness);

    IDWriteFont_Release(font);
    IDWriteGdiInterop_Release(interop);
}
示例#17
0
/*
*  Message Action Function
*/
LRESULT MainWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandle)
{
	auto hr = Initialize();
	if (hr != S_OK) {
		::MessageBoxW(nullptr, L"Initialize() failed", L"Fatal error", MB_OK | MB_ICONSTOP);
		std::terminate();
		return S_FALSE;
	}
	HICON hIcon = LoadIconW(GetModuleHandleW(nullptr), MAKEINTRESOURCEW(IDI_CLANGBUILDERUI));
	SetIcon(hIcon, TRUE);
	HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
	LOGFONTW logFont = { 0 };
	GetObjectW(hFont, sizeof(logFont), &logFont);
	DeleteObject(hFont);
	hFont = NULL;
	logFont.lfHeight = 19;
	logFont.lfWeight = FW_NORMAL;
	wcscpy_s(logFont.lfFaceName, L"Segoe UI");
	hFont = CreateFontIndirectW(&logFont);
	auto LambdaCreateWindow = [&](LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle,
								  int X, int Y, int nWidth, int nHeight, HMENU hMenu)->HWND{
		auto hw = CreateWindowExW(WINDOWEXSTYLE, lpClassName, lpWindowName,
								  dwStyle, X, Y, nWidth, nHeight, m_hWnd, hMenu, HINST_THISCOMPONENT, nullptr);
		if (hw) {
			::SendMessageW(hw, WM_SETFONT, (WPARAM)hFont, lParam);
		}
		return hw;
	};
	hCobVS_ = LambdaCreateWindow(WC_COMBOBOXW, L"", COMBOBOXSTYLE, 200, 20, 400, 30, nullptr);
	hCobArch_ = LambdaCreateWindow(WC_COMBOBOXW, L"", COMBOBOXSTYLE, 200, 60, 400, 30, nullptr);
	hCobFlavor_ = LambdaCreateWindow(WC_COMBOBOXW, L"", COMBOBOXSTYLE, 200, 100, 400, 30, nullptr);
	hCheckBoostrap_ = LambdaCreateWindow(WC_BUTTONW, L"Clang Boostrap", CHECKBOXSTYLE, 200, 160, 360, 27, nullptr);
	hCheckReleased_ = LambdaCreateWindow(WC_BUTTONW, L"Released Revision", CHECKBOXSTYLE, 200, 190, 360, 27, nullptr);
	hCheckPackaged_ = LambdaCreateWindow(WC_BUTTONW, L"Make installation package", CHECKBOXSTYLE, 200, 220, 360, 27, nullptr);
	hCheckCleanEnv_ = LambdaCreateWindow(WC_BUTTONW, L"Use Clean Environment", CHECKBOXSTYLE, 200, 250, 360, 27, nullptr);
	hCheckLink_ = LambdaCreateWindow(WC_BUTTONW, L"Link Static Runtime Library", CHECKBOXSTYLE, 200, 280, 360, 27, nullptr);
	hCheckNMake_ = LambdaCreateWindow(WC_BUTTONW, L"Use NMake Makefiles", CHECKBOXSTYLE, 200, 310, 360, 27, nullptr);
	hCheckLLDB_ = LambdaCreateWindow(WC_BUTTONW, L"Build LLDB (Visual Studio 2015 or Later)", CHECKBOXSTYLE, 200, 340, 360, 27, nullptr);
	//Button_SetElevationRequiredState
	hButtonTask_ = LambdaCreateWindow(WC_BUTTONW, L"Build Now", PUSHBUTTONSTYLE, 200, 395, 195, 30, (HMENU)IDC_BUTTON_STARTTASK);
	hButtonEnv_ = LambdaCreateWindow(WC_BUTTONW, L"Startup Env", PUSHBUTTONSTYLE | BS_ICON, 410, 395, 195, 30, (HMENU)IDC_BUTTON_STARTENV);

	HMENU hSystemMenu = ::GetSystemMenu(m_hWnd, FALSE);
	InsertMenuW(hSystemMenu, SC_CLOSE, MF_ENABLED, IDM_CLANGBUILDER_ABOUT, L"About ClangbuilderUI\tAlt+F1");

	label_.push_back(KryceLabel(30, 20, 190, 50, L"Visual Studio\t\xD83C\xDD9A:"));
	label_.push_back(KryceLabel(30, 60, 190, 90, L"Address Mode\t\xD83D\xDEE0:"));
	label_.push_back(KryceLabel(30, 100, 190, 130, L"Configuration\t\x2699:"));
	label_.push_back(KryceLabel(30, 160, 190, 200, L"Compile Switch\t\xD83D\xDCE6:"));
	///
	if (!InitializeControl()) {

	}
	//DeleteObject(hFont);
	return S_OK;
}
示例#18
0
HFONT WINAPI MyCreateFontIndirectA(LOGFONTA *lplf)
{
    LOGFONTW lf;

    CopyStruct(&lf, lplf, sizeof(*lplf) - sizeof(lplf->lfFaceName));
    lf.lfCharSet = GB2312_CHARSET;
    CopyStruct(lf.lfFaceName, DEFAULT_FACE_NAME, sizeof(DEFAULT_FACE_NAME));

    return CreateFontIndirectW(&lf);
}
示例#19
0
文件: font.c 项目: miurahr/wine
/*******************************************************************************
 * GdipCreateFont [GDIPLUS.@]
 *
 * Create a new font based off of a FontFamily
 *
 * PARAMS
 *  *fontFamily     [I] Family to base the font off of
 *  emSize          [I] Size of the font
 *  style           [I] Bitwise OR of FontStyle enumeration
 *  unit            [I] Unit emSize is measured in
 *  **font          [I] the resulting Font object
 *
 * RETURNS
 *  SUCCESS: Ok
 *  FAILURE: InvalidParameter if fontfamily or font is NULL.
 *  FAILURE: FontFamilyNotFound if an invalid FontFamily is given
 *
 * NOTES
 *  UnitDisplay is unsupported.
 *  emSize is stored separately from lfHeight, to hold the fraction.
 */
GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily,
                        REAL emSize, INT style, Unit unit, GpFont **font)
{
    HFONT hfont;
    OUTLINETEXTMETRICW otm;
    LOGFONTW lfw;
    HDC hdc;
    GpStatus stat;
    int ret;

    if (!fontFamily || !font || emSize < 0.0)
        return InvalidParameter;

    TRACE("%p (%s), %f, %d, %d, %p\n", fontFamily,
            debugstr_w(fontFamily->FamilyName), emSize, style, unit, font);

    memset(&lfw, 0, sizeof(lfw));

    stat = GdipGetFamilyName(fontFamily, lfw.lfFaceName, LANG_NEUTRAL);
    if (stat != Ok) return stat;

    lfw.lfHeight = -units_to_pixels(emSize, unit, fontFamily->dpi);
    lfw.lfWeight = style & FontStyleBold ? FW_BOLD : FW_REGULAR;
    lfw.lfItalic = style & FontStyleItalic;
    lfw.lfUnderline = style & FontStyleUnderline;
    lfw.lfStrikeOut = style & FontStyleStrikeout;

    hfont = CreateFontIndirectW(&lfw);
    hdc = CreateCompatibleDC(0);
    SelectObject(hdc, hfont);
    otm.otmSize = sizeof(otm);
    ret = GetOutlineTextMetricsW(hdc, otm.otmSize, &otm);
    DeleteDC(hdc);
    DeleteObject(hfont);

    if (!ret) return NotTrueTypeFont;

    *font = GdipAlloc(sizeof(GpFont));
    if (!*font) return OutOfMemory;

    (*font)->unit = unit;
    (*font)->emSize = emSize;
    (*font)->otm = otm;

    stat = clone_font_family(fontFamily, &(*font)->family);
    if (stat != Ok)
    {
        GdipFree(*font);
        return stat;
    }

    TRACE("<-- %p\n", *font);

    return Ok;
}
示例#20
0
文件: style.c 项目: howard5888/wineT
HFONT ME_SelectStyleFont(ME_TextEditor *editor, HDC hDC, ME_Style *s)
{
  HFONT hOldFont;
  LOGFONTW lf;
  int i, nEmpty, nAge = 0x7FFFFFFF;
  ME_FontCacheItem *item;
  assert(hDC);
  assert(s);
  
  ME_LogFontFromStyle(hDC, &lf, s, editor->nZoomNumerator, editor->nZoomDenominator);
  
  for (i=0; i<HFONT_CACHE_SIZE; i++)
    editor->pFontCache[i].nAge++;
  for (i=0, nEmpty=-1, nAge=0; i<HFONT_CACHE_SIZE; i++)
  {
    item = &editor->pFontCache[i];
    if (!item->nRefs)
    {
      if (item->nAge > nAge)
        nEmpty = i, nAge = item->nAge;
    }
    if (item->hFont && ME_IsFontEqual(&item->lfSpecs, &lf))
      break;
  }
  if (i < HFONT_CACHE_SIZE) /* found */
  {
    item = &editor->pFontCache[i];
    TRACE_(richedit_style)("font reused %d\n", i);

    s->hFont = item->hFont;
    item->nRefs++;
  }
  else
  {
    item = &editor->pFontCache[nEmpty]; /* this legal even when nEmpty == -1, as we don't dereference it */

    assert(nEmpty != -1); /* otherwise we leak cache entries or get too many fonts at once*/
    if (item->hFont) {
      TRACE_(richedit_style)("font deleted %d\n", nEmpty);
      DeleteObject(item->hFont);
      item->hFont = NULL;
    }
    s->hFont = CreateFontIndirectW(&lf);
    assert(s->hFont);
    TRACE_(richedit_style)("font created %d\n", nEmpty);
    item->hFont = s->hFont;
    item->nRefs = 1;
    memcpy(&item->lfSpecs, &lf, sizeof(LOGFONTW));
  }
  hOldFont = SelectObject(hDC, s->hFont);
  /* should be cached too, maybe ? */
  GetTextMetricsW(hDC, &s->tm);
  return hOldFont;
}
示例#21
0
文件: help.c 项目: YokoZar/wine
static void HH_CreateFont(HHInfo *pHHInfo)
{
    LOGFONTW lf;

    GetObjectW(GetStockObject(DEFAULT_GUI_FONT), sizeof(LOGFONTW), &lf);
    lf.lfWeight = FW_NORMAL;
    lf.lfItalic = FALSE;
    lf.lfUnderline = FALSE;

    pHHInfo->hFont = CreateFontIndirectW(&lf);
}
示例#22
0
int ReloadFont(WPARAM wParam, LPARAM lParam) 
{
#ifdef _UNICODE
	if(ServiceExists(MS_FONT_GETW)) {
		LOGFONTW log_font;
		if(hFontFirstLine) DeleteObject(hFontFirstLine);
		colFirstLine = CallService(MS_FONT_GETW, (WPARAM)&font_id_firstlinew, (LPARAM)&log_font);
		hFontFirstLine = CreateFontIndirectW(&log_font);
		if(hFontSecondLine) DeleteObject(hFontSecondLine);
		colSecondLine = CallService(MS_FONT_GETW, (WPARAM)&font_id_secondlinew, (LPARAM)&log_font);
		hFontSecondLine = CreateFontIndirectW(&log_font);
		if(hFontTime) DeleteObject(hFontTime);
		colTime = CallService(MS_FONT_GETW, (WPARAM)&font_id_timew, (LPARAM)&log_font);
		hFontTime = CreateFontIndirectW(&log_font);

		colBg = CallService(MS_COLOUR_GETW, (WPARAM)&colour_id_bgw, 0);
		colBorder = CallService(MS_COLOUR_GETW, (WPARAM)&colour_id_borderw, 0);
		colSidebar = CallService(MS_COLOUR_GETW, (WPARAM)&colour_id_sidebarw, 0);
		colTitleUnderline = CallService(MS_COLOUR_GETW, (WPARAM)&colour_id_titleunderlinew, 0);
	} else
#endif
	{
		LOGFONTA log_font;
		if(hFontFirstLine) DeleteObject(hFontFirstLine);
		colFirstLine = CallService(MS_FONT_GET, (WPARAM)&font_id_firstline, (LPARAM)&log_font);
		hFontFirstLine = CreateFontIndirectA(&log_font);
		if(hFontSecondLine) DeleteObject(hFontSecondLine);
		colSecondLine = CallService(MS_FONT_GET, (WPARAM)&font_id_secondline, (LPARAM)&log_font);
		hFontSecondLine = CreateFontIndirectA(&log_font);
		if(hFontTime) DeleteObject(hFontTime);
		colTime = CallService(MS_FONT_GET, (WPARAM)&font_id_time, (LPARAM)&log_font);
		hFontTime = CreateFontIndirectA(&log_font);

		colBg = CallService(MS_COLOUR_GET, (WPARAM)&colour_id_bg, 0);
		colBorder = CallService(MS_COLOUR_GET, (WPARAM)&colour_id_border, 0);
		colSidebar = CallService(MS_COLOUR_GET, (WPARAM)&colour_id_sidebar, 0);
		colTitleUnderline = CallService(MS_COLOUR_GET, (WPARAM)&colour_id_titleunderline, 0);
	}

	return 0;
}
示例#23
0
static
HFONT
SetLrgFont(PMAP infoPtr)
{
    LOGFONTW lf;
    HFONT hFont = NULL;
    HDC hdc;
    HWND hCombo;
    LPWSTR lpFontName;
    INT Len;

    hCombo = GetDlgItem(infoPtr->hParent,
                        IDC_FONTCOMBO);

    Len = GetWindowTextLengthW(hCombo);

    if (Len != 0)
    {
        lpFontName = HeapAlloc(GetProcessHeap(),
                               0,
                               (Len + 1) * sizeof(WCHAR));

        if (lpFontName)
        {
            SendMessageW(hCombo,
                         WM_GETTEXT,
                         Len + 1,
                         (LPARAM)lpFontName);

            ZeroMemory(&lf,
                       sizeof(lf));

            hdc = GetDC(infoPtr->hLrgWnd);
            lf.lfHeight = GetDeviceCaps(hdc,
                                        LOGPIXELSY) / 2;
            ReleaseDC(infoPtr->hLrgWnd,
                      hdc);

            lf.lfCharSet =  DEFAULT_CHARSET;
            wcsncpy(lf.lfFaceName,
                    lpFontName,
                    sizeof(lf.lfFaceName) / sizeof(lf.lfFaceName[0]));

            hFont = CreateFontIndirectW(&lf);

            HeapFree(GetProcessHeap(),
                     0,
                     lpFontName);
        }
    }

    return hFont;
}
示例#24
0
static QString getEnglishName(const QString &familyName)
{
    QString i18n_name;

    HDC hdc = GetDC( 0 );
    HFONT hfont;
    QT_WA( {
        LOGFONTW lf;
        memset( &lf, 0, sizeof( LOGFONTW ) );
        memcpy( lf.lfFaceName, familyName.utf16(), qMin(LF_FACESIZE, familyName.length())*sizeof(QChar) );
        lf.lfCharSet = DEFAULT_CHARSET;
        hfont = CreateFontIndirectW( &lf );
    }, {
示例#25
0
/**
 * @brief フォントを作成して、それを返します。
 * @param	szFontName	フォントの名前
 * @param	nPoint		フォントの大きさ
 * @param	hDC			デバイスコンテキストハンドル
 */
HFONT CFontObjects::GetFontHandle(const wchar_t *szFontName,int nHeight,bool bBold,int nCharSets)
{
	LOGFONTW fontStruct;
	memset(&fontStruct,0,sizeof(LOGFONTW));
	fontStruct.lfHeight = -nHeight;
	fontStruct.lfWeight = (bBold ? m_fnWeight : FW_NORMAL);
	fontStruct.lfCharSet = nCharSets;
	fontStruct.lfOutPrecision = OUT_DEFAULT_PRECIS;
	fontStruct.lfClipPrecision = CLIP_DEFAULT_PRECIS;
	fontStruct.lfQuality = DEFAULT_QUALITY;
	fontStruct.lfPitchAndFamily = FF_MODERN | FIXED_PITCH;
	wcsncpy(fontStruct.lfFaceName,szFontName,LF_FACESIZE);
	return CreateFontIndirectW(&fontStruct);
}
示例#26
0
/******************************************************************************
 *           create_stock_font
 */
static HFONT create_stock_font( char const *fontName, const LOGFONTW *font, HKEY hkey )
{
    LOGFONTW lf;
    char  key[256];
    char buffer[MAX_PATH];
    DWORD type, count;

    if (!hkey) return CreateFontIndirectW( font );

    lf = *font;
    sprintf(key, "%s.Height", fontName);
    count = sizeof(buffer);
    if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
        lf.lfHeight = atoi(buffer);

    sprintf(key, "%s.Bold", fontName);
    count = sizeof(buffer);
    if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
        lf.lfWeight = get_bool(buffer) ? FW_BOLD : FW_NORMAL;

    sprintf(key, "%s.Italic", fontName);
    count = sizeof(buffer);
    if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
        lf.lfItalic = get_bool(buffer);

    sprintf(key, "%s.Underline", fontName);
    count = sizeof(buffer);
    if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
        lf.lfUnderline = get_bool(buffer);

    sprintf(key, "%s.StrikeOut", fontName);
    count = sizeof(buffer);
    if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
        lf.lfStrikeOut = get_bool(buffer);
    return CreateFontIndirectW( &lf );
}
示例#27
0
static BOOL get_icon_text_metrics( HWND hwnd, TEXTMETRICW *tm )
{
    BOOL ret;
    HDC hdc;
    LOGFONTW lf;
    HFONT hfont;

    hdc = GetDC( hwnd );
    SystemParametersInfoW( SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0 );
    hfont = SelectObject( hdc, CreateFontIndirectW( &lf ) );
    ret = GetTextMetricsW( hdc, tm );
    SelectObject( hdc, hfont );
    ReleaseDC( hwnd, hdc );
    return ret;
}
示例#28
0
HFONT CachedFont::GetHFont() {
    if (!hFont) {
        LOGFONTW lf;
        // TODO: Graphics is probably only used for metrics,
        // so this might not be 100% correct (e.g. 2 monitors with different DPIs?)
        // but previous code wasn't much better
        Graphics *gfx = AllocGraphicsForMeasureText();
        Status status = font->GetLogFontW(gfx, &lf);
        FreeGraphicsForMeasureText(gfx);
        CrashIf(status != Ok);
        hFont = CreateFontIndirectW(&lf);
        CrashIf(!hFont);
    }
    return hFont;
}
示例#29
0
文件: syslink.c 项目: bpon/wine
/***********************************************************************
 *           SYSLINK_SetFont
 * Set new Font for the SysLink control.
 */
static HFONT SYSLINK_SetFont (SYSLINK_INFO *infoPtr, HFONT hFont, BOOL bRedraw)
{
    HDC hdc;
    LOGFONTW lf;
    TEXTMETRICW tm;
    RECT rcClient;
    HFONT hOldFont = infoPtr->Font;
    infoPtr->Font = hFont;
    
    /* free the underline font */
    if(infoPtr->LinkFont != NULL)
    {
        DeleteObject(infoPtr->LinkFont);
        infoPtr->LinkFont = NULL;
    }

    /* Render text position and word wrapping in memory */
    if (GetClientRect(infoPtr->Self, &rcClient))
    {
        hdc = GetDC(infoPtr->Self);
        if(hdc != NULL)
        {
            /* create a new underline font */
            if(GetTextMetricsW(hdc, &tm) &&
               GetObjectW(infoPtr->Font, sizeof(LOGFONTW), &lf))
            {
                lf.lfUnderline = TRUE;
                infoPtr->LinkFont = CreateFontIndirectW(&lf);
                infoPtr->BreakChar = tm.tmBreakChar;
            }
            else
            {
                ERR("Failed to create link font!\n");
            }

            SYSLINK_Render(infoPtr, hdc, &rcClient);
            ReleaseDC(infoPtr->Self, hdc);
        }
    }
    
    if(bRedraw)
    {
        RedrawWindow(infoPtr->Self, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
    }
    
    return hOldFont;
}
示例#30
0
VOID GUIFont::Create( LPWSTR _pFaceName, INT _iWidth, INT _iHeight, LPDIRECT3DDEVICE9 _pd3dDevice )
{
	if( m_hWnd == NULL )
		MessageBox( NULL, L"GUIFont::SetHWND( _hWnd )를 하지 않았습니다", NULL, MB_OK );

	this->Cleanup();

	//	Create d3dFont
	D3DXFONT_DESC desc;
	ZeroMemory( &desc, sizeof( D3DXFONT_DESC ) );

	desc.Width				=	_iWidth;
	desc.Height				=	_iHeight;
	desc.Weight				=	FW_NORMAL;
	desc.MipLevels			=	D3DX_DEFAULT;
	desc.Italic				=	FALSE;
	desc.CharSet			=	DEFAULT_CHARSET;
	desc.OutputPrecision	=	OUT_DEFAULT_PRECIS;
	desc.Quality			=	DEFAULT_QUALITY;
	desc.PitchAndFamily		=	DEFAULT_PITCH;

	lstrcpy( desc.FaceName, _pFaceName );

	if( FAILED( D3DXCreateFontIndirect( _pd3dDevice, &desc, &m_pd3dFont ) ) )
		MessageBox( NULL, L"D3DXCreateFontIndirect() failed", NULL, MB_OK );

	//	Create hFont
	//	Get HDC
	//	GetTextExtentPoint32W에 들어갈 글자 정보가 있는 HDC를 구한다
	LOGFONTW lf;
	ZeroMemory( &lf, sizeof( LOGFONTW ) );

	lf.lfWidth				= desc.Width;		
	lf.lfHeight				= desc.Height;
	lf.lfWeight				= desc.Weight;
	lf.lfItalic				= desc.Italic;
	lf.lfCharSet			= desc.CharSet;
	lf.lfOutPrecision		= desc.OutputPrecision;
	lf.lfQuality			= desc.Quality;
	lf.lfPitchAndFamily		= desc.PitchAndFamily;

	lstrcpy( lf.lfFaceName, desc.FaceName );

	m_hDC		= GetDC( m_hWnd );
	m_hFont		= CreateFontIndirectW( &lf );
	m_hOldFont	= (HFONT)SelectObject( m_hDC, m_hFont );
}