1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** GUIX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** Context Management (Context) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_system.h" |
29 |
|
|
#include "gx_context.h" |
30 |
|
|
|
31 |
|
|
/**************************************************************************/ |
32 |
|
|
/* */ |
33 |
|
|
/* FUNCTION RELEASE */ |
34 |
|
|
/* */ |
35 |
|
|
/* _gx_context_font_get PORTABLE C */ |
36 |
|
|
/* 6.1 */ |
37 |
|
|
/* AUTHOR */ |
38 |
|
|
/* */ |
39 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
40 |
|
|
/* */ |
41 |
|
|
/* DESCRIPTION */ |
42 |
|
|
/* */ |
43 |
|
|
/* This service gets font associated with the specified resource ID. */ |
44 |
|
|
/* */ |
45 |
|
|
/* INPUT */ |
46 |
|
|
/* */ |
47 |
|
|
/* resource_id Resource ID of font */ |
48 |
|
|
/* return_font Pointer to destination for */ |
49 |
|
|
/* font pointer */ |
50 |
|
|
/* */ |
51 |
|
|
/* OUTPUT */ |
52 |
|
|
/* */ |
53 |
|
|
/* status Completion status */ |
54 |
|
|
/* */ |
55 |
|
|
/* CALLS */ |
56 |
|
|
/* */ |
57 |
|
|
/* None */ |
58 |
|
|
/* */ |
59 |
|
|
/* CALLED BY */ |
60 |
|
|
/* */ |
61 |
|
|
/* Application Code */ |
62 |
|
|
/* _gx_context_font_set */ |
63 |
|
|
/* */ |
64 |
|
|
/**************************************************************************/ |
65 |
|
966243 |
UINT _gx_context_font_get(GX_RESOURCE_ID resource_id, GX_FONT **return_font) |
66 |
|
|
{ |
67 |
|
966243 |
GX_DRAW_CONTEXT *context = _gx_system_current_draw_context; |
68 |
|
|
GX_DISPLAY *display; |
69 |
|
|
GX_RESOURCE_ID font_table_size; |
70 |
|
|
|
71 |
|
966243 |
*return_font = GX_NULL; |
72 |
|
|
|
73 |
|
966243 |
display = context -> gx_draw_context_display; |
74 |
|
|
|
75 |
|
|
/* Pickup the font table size. */ |
76 |
|
966243 |
font_table_size = display -> gx_display_font_table_size; |
77 |
|
|
|
78 |
|
|
/* Determine if the ID is within range. */ |
79 |
✓✓ |
966243 |
if (resource_id < font_table_size) |
80 |
|
|
{ |
81 |
|
|
/* Yes, the ID is within range. Perform a table lookup and return the |
82 |
|
|
font poiner. */ |
83 |
|
966028 |
*return_font = display -> gx_display_font_table[resource_id]; |
84 |
|
|
} |
85 |
|
|
else |
86 |
|
|
{ |
87 |
|
215 |
return(GX_INVALID_RESOURCE_ID); |
88 |
|
|
} |
89 |
|
|
|
90 |
|
966028 |
return(GX_SUCCESS); |
91 |
|
|
} |
92 |
|
|
|