| 1 | /* |
| 2 | * $Id: HFONT.java,v 1.2 2005/12/01 06:10:00 hastings Exp $ |
| 3 | * |
| 4 | * (c) Copyright, Moebius Solutions, Inc., 2004 |
| 5 | * |
| 6 | * All Rights Reserved |
| 7 | * |
| 8 | * This material may be reproduced by or for the U. S. Government |
| 9 | * pursuant to the copyright license under the clause at |
| 10 | * DFARS 252.227-7014 (OCT 2001). |
| 11 | */ |
| 12 | |
| 13 | package com.moesol.bindings.platform_sdk.windows_api; |
| 14 | |
| 15 | /** |
| 16 | * Holds a Win32 HFONT. |
| 17 | */ |
| 18 | public class HFONT extends HGDIOBJ { |
| 19 | HFONT(long font, boolean temporary) { |
| 20 | super(font, temporary); |
| 21 | } |
| 22 | HFONT(long font) { |
| 23 | super(font); |
| 24 | } |
| 25 | /** |
| 26 | * Create a font using CreateFontIndirect. |
| 27 | * @param logfont |
| 28 | * @return the HFONT that was created. |
| 29 | */ |
| 30 | public static HFONT createFontIndirect(LOGFONT logfont) { |
| 31 | long r = jni_createFontIndirect(logfont._getStructureBytes()); |
| 32 | if (r == 0) { |
| 33 | throw new RuntimeException("createFontIndirect failed"); |
| 34 | } |
| 35 | return new HFONT(r); |
| 36 | } |
| 37 | |
| 38 | public static final byte ANSI_CHARSET = 0; |
| 39 | public static final byte DEFAULT_CHARSET = 1; |
| 40 | public static final byte SYMBOL_CHARSET = 2; |
| 41 | public static final byte OEM_CHARSET = -1; |
| 42 | |
| 43 | private static native long jni_createFontIndirect(byte[] logfont_bytes); |
| 44 | } |