Listing the "Blender Foundation" as copyright holder implied the Blender Foundation holds copyright to files which may include work from many developers. While keeping copyright on headers makes sense for isolated libraries, Blender's own code may be refactored or moved between files in a way that makes the per file copyright holders less meaningful. Copyright references to the "Blender Foundation" have been replaced with "Blender Authors", with the exception of `./extern/` since these this contains libraries which are more isolated, any changed to license headers there can be handled on a case-by-case basis. Some directories in `./intern/` have also been excluded: - `./intern/cycles/` it's own `AUTHORS` file is planned. - `./intern/opensubdiv/`. An "AUTHORS" file has been added, using the chromium projects authors file as a template. Design task: #110784 Ref !110783.
61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
/* SPDX-FileCopyrightText: 2009 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup blf
|
|
*
|
|
* Default API, that uses Blender's user preferences for the default size.
|
|
*/
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
#include "BLI_assert.h"
|
|
|
|
#include "BLF_api.h"
|
|
|
|
#include "blf_internal.h"
|
|
|
|
/* call BLF_default_set first! */
|
|
#define ASSERT_DEFAULT_SET BLI_assert(global_font_default != -1)
|
|
|
|
/* Default size and dpi, for BLF_draw_default. */
|
|
static int global_font_default = -1;
|
|
/* Keep in sync with `UI_DEFAULT_TEXT_POINTS` */
|
|
static float global_font_size = 11.0f;
|
|
|
|
void BLF_default_size(float size)
|
|
{
|
|
global_font_size = size;
|
|
}
|
|
|
|
void BLF_default_set(int fontid)
|
|
{
|
|
if ((fontid == -1) || blf_font_id_is_valid(fontid)) {
|
|
global_font_default = fontid;
|
|
}
|
|
}
|
|
|
|
int BLF_default()
|
|
{
|
|
ASSERT_DEFAULT_SET;
|
|
return global_font_default;
|
|
}
|
|
|
|
int BLF_set_default()
|
|
{
|
|
ASSERT_DEFAULT_SET;
|
|
|
|
BLF_size(global_font_default, global_font_size * UI_SCALE_FAC);
|
|
|
|
return global_font_default;
|
|
}
|
|
|
|
void BLF_draw_default(float x, float y, float z, const char *str, const size_t str_len)
|
|
{
|
|
ASSERT_DEFAULT_SET;
|
|
BLF_size(global_font_default, global_font_size * UI_SCALE_FAC);
|
|
BLF_position(global_font_default, x, y, z);
|
|
BLF_draw(global_font_default, str, str_len);
|
|
}
|