Commit Graph

744 Commits

Author SHA1 Message Date
Campbell Barton 6b9a500a3a Cleanup: disambiguate terms "name", "file" & "str" / "string"
- Rename name/filename/path to filepath when it's used for full paths.
- Rename name/path to dirpath when it refers to a directory.
- Rename file to filepath or path (when it may be a file or dir).
- Rename ImBuf::name & anim::name to filepath.
2023-05-03 15:26:14 +10:00
Campbell Barton 1ab72e8459 Cleanup: use BLI_path_* prefix for path splitting functions
Also order string size after each string instead of grouping strings and
their sizes afterwards.
2023-05-02 21:08:13 +10:00
Campbell Barton 6859bb6e67 Cleanup: format (with BraceWrapping::AfterControlStatement "MultiLine") 2023-05-02 09:37:49 +10:00
Campbell Barton b132118f89 Cleanup: balance doxygen grouping, minor grouping adjustment 2023-04-19 09:02:21 +10:00
Sergey Sharybin a12a8a71bb Remove "All Rights Reserved" from Blender Foundation copyright code
The goal is to solve confusion of the "All rights reserved" for licensing
code under an open-source license.

The phrase "All rights reserved" comes from a historical convention that
required this phrase for the copyright protection to apply. This convention
is no longer relevant.

However, even though the phrase has no meaning in establishing the copyright
it has not lost meaning in terms of licensing.

This change makes it so code under the Blender Foundation copyright does
not use "all rights reserved". This is also how the GPL license itself
states how to apply it to the source code:

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software ...

This change does not change copyright notice in cases when the copyright
is dual (BF and an author), or just an author of the code. It also does
mot change copyright which is inherited from NaN Holding BV as it needs
some further investigation about what is the proper way to handle it.
2023-03-30 10:51:59 +02:00
Sergey Sharybin d32d787f5f Clang-Format: Allow empty functions to be single-line
For example

```
OIIOOutputDriver::~OIIOOutputDriver()
{
}
```

becomes

```
OIIOOutputDriver::~OIIOOutputDriver() {}
```

Saves quite some vertical space, which is especially handy for
constructors.

Pull Request: https://projects.blender.org/blender/blender/pulls/105594
2023-03-29 16:50:54 +02:00
Campbell Barton 1ddbe7cadd Cleanup: move doc-strings into headers, remove duplicates
In some cases move implementation details into the function body.
2023-03-29 14:37:34 +11:00
Campbell Barton bbcfdb844c Cleanup: quiet strict-prototypes warning with CLANG 2023-03-28 15:57:48 +11:00
Harley Acheson 1d84216c09 Fix #105891: Faster Font Fallback Finding
An improved strategy for finding glyphs within our font fallback stack.

Pull Request: https://projects.blender.org/blender/blender/pulls/106011
2023-03-24 19:55:28 +01:00
Harley Acheson f78f05c749 Refactor: U.dpi_fac -> U.scale_factor
A renaming of UI scale factors from names that imply a relationship to
monitor DPI to names that imply that they simply change "scale"

Pull Request: https://projects.blender.org/blender/blender/pulls/105750
2023-03-17 04:19:05 +01:00
Campbell Barton b3625e6bfd Cleanup: comment blocks 2023-03-09 10:39:49 +11:00
Leon Schittek 4b0f5c2aad Fix build error introduced in previous commit.
Fix build error introduced in 57742c7868 due to int/float conversion.
2023-03-04 08:04:35 +01:00
Leon Schittek 57742c7868 Fix: Wrong text clipping in the frame node
When drawing text with multiple lines inside a frame node, depending
on the zoom level some lines would wrongly get clipped despite being
inside the clipping region.

This was caused by the clipping check in `blf_glyph_draw` not accounting
for the font’s aspect.

Pull Request #105389
2023-03-04 07:12:14 +01:00
Harley Acheson d0cfbc23db Merge branch 'blender-v3.5-release' 2023-03-03 15:37:11 -08:00
Harley Acheson 89c3ead7c6 Fix #105388: Default Font Accidentally Kerning
Move the code that disables kerning for the default font so it can't be
re-enabled by the cache subsystem.

Pull Request #105415
2023-03-03 23:17:20 +01:00
Clément Foucault 9fb1f32f06 Cleanup: GPUTexture: Remove _ex suffix from texture creation
It isn't relevant anymore now that usage flags are mandatory.

Pull Request #105197
2023-02-25 11:39:54 +01:00
Harley Acheson 470e8ce1f4 BLF: Revert Glyph Clipping Changes
Revert #104679. We are just too used to the old behavior, especially
the incorrect vertical clipping. Some uses rely on setting the min and
max of the clipping rect the same. Will have to revisit this later
to only correct for horizontal positioning for full hinting.

Pull Request #105157

Own Code.
2023-02-23 23:44:17 +01:00
Harley Acheson 54fa3b124f BLF: Glyph Clipping Corrections
Improvements to how glyphs are tested against the font clipping rect.

Pull Request #104679
2023-02-22 10:00:37 -08:00
Campbell Barton 91346755ce Cleanup: use '#' prefix for issues instead of 'T'
Match the convention from Gitea instead of Phabricator's T for tasks.
2023-02-12 14:56:05 +11:00
Campbell Barton 0381fe7bfe Cleanup: update username in code-comments: campbellbarton -> ideasman42
Gitea migration changed my username, update code-comments.
2023-02-09 11:33:48 +11:00
Campbell Barton 60d9de767d Cleanup: remove redundant forward declarations for structs 2023-01-18 18:41:13 +11:00
Harley Acheson 485ab42075 BLF: Improved CJK Font Preview Differentiation
Use font's OS/2 table code page range bits to help differentiate
between Korean, Japanese, Simplified & Traditional Chinese fonts.

See D16484 for details.

Differential Revision: https://developer.blender.org/D16484

Reviewed by Brecht Van Lommel
2023-01-09 21:40:08 -08:00
Jason Fielder 2e61c446ac GPU: Explicit Texture Usage Flags for enabling GPU Backend optimizations.
Texture usage flags can now be provided during texture creation specifying
the ways in which a texture can be used. This allows the GPU backends to
perform contextual optimizations which were not previously possible. This
includes enablement of hardware lossless compression which can result in
a 15%+ performance uplift for bandwidth-limited scenes on hardware such
as Apple-Silicon using Metal.

GPU_TEXTURE_USAGE_GENERAL can be used by default if usage is not known
ahead of time. Patch will also be relevant for the Vulkan backend.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D15967
2022-12-08 23:31:05 +01:00
Harley Acheson a43053a00a Improved Korean Font Sample
Small change to the text sample used for Korean font previews

See D16428 for details.

Differential Revision: https://developer.blender.org/D16428

Reviewed by Brecht Van Lommel
2022-11-09 08:51:00 -08:00
Harley Acheson 694481095b Fix for T101506: BLF Disable Kerning in Main Font
Disable kerning in our main font to exactly restore the spacing of text
as seen in Blender 3.1 - 3.3

See D16186 for more details.

Differential Revision: https://developer.blender.org/D16186

Reviewed by Brecht Van Lommel
2022-10-17 08:35:11 -07:00
Campbell Barton 9f6a045e23 Cleanup: replace BLI_join_dirfile with BLI_path_join
These functions are almost identical, the main difference being
BLI_join_dirfile didn't trim existing slashes when joining paths
however this isn't an important difference that warrants a separate
function.
2022-10-17 11:38:54 +11:00
Campbell Barton 331f850056 Cleanup: redundant parenthesis 2022-10-07 22:55:03 +11:00
Campbell Barton c2c31afa92 Cleanup: split BLF glyph rendering into a function
This makes the drawing loop easier to follow.
2022-10-06 16:28:12 +11:00
Ray Molenkamp ed6764dede Fix: build issue with MSVC
Issue introduced by rB208b3a0472b3
which fixed a build issue on linux.

This fix is a band-aid at best but
reverting rB208b3a0472b3 is not
really an option since that would
break linux again.
2022-10-02 10:17:05 -06:00
Brecht Van Lommel 208b3a0472 Fix build error on Linux after font thumbnail changes 2022-10-02 15:06:34 +02:00
Campbell Barton dbc097d6b8 Fix error in blf_get_sample_text returning a pointer to stack memory
Copy-by-value was used when iterating over unicode_samples which
then referenced an array from the value.

Resolve by referencing a const pointer to the unicode_sample array.
2022-09-30 15:03:18 +10:00
Harley Acheson 12fdf9069a BLF: Editing Text with Combining Characters
Corrections for caret insertion & movement and deletion for text
strings that include non-precomposed diacritical marks (Unicode
combining characters).

See D15659 for more details and examples.

Differential Revision: https://developer.blender.org/D15659

Reviewed by Campbell Barton
2022-09-27 08:40:36 -07:00
Campbell Barton 3961d3493b Cleanup: use 'u' prefixed integer types for brevity in C code
This also simplifies using function style casts when moving to C++.
2022-09-26 11:33:22 +10:00
Harley Acheson b3714b1e85 BLF: Refactor of blf_font_boundbox_foreach_glyph
Refactor of `BLF_boundbox_foreach_glyph` and simplification of its
usage by only passing translated glyph bounds to callbacks.

See D15765 for more details.

Differential Revision: https://developer.blender.org/D15765

Reviewed by Campbell Barton
2022-09-25 11:25:31 -07:00
Campbell Barton 891949cbb4 Cleanup: use 'u' prefixed integer types for brevity & cast style
To use function style cast '(unsigned char)x' can't be replaced by
'unsigned char(x)'.
2022-09-25 18:26:27 +10:00
Campbell Barton 26f330ea4c Cleanup: format, spelling in comments 2022-09-25 15:24:37 +10:00
Harley Acheson 4e7983e073 UI: Improved Font Thumbnails
Thumbnails of fonts that better show design, shapes, contents, intent,
and intended language. Previews almost every known language - living
and dead - and symbol, specialty fonts, etc.

See D12032 for more details and samples.

Differential Revision: https://developer.blender.org/D12032

Reviewed by Campbell Barton
2022-09-24 10:57:34 -07:00
Harley Acheson 72933ebe96 BLF: Correctly Set Default Font Size
Commit cd1631b17d fails to scale the global_font_size by UI scale in
BLF_set_default. Generally used for simple text output like statistics.

See D16053 for more details.

Differential Revision: https://developer.blender.org/D16053

Own Code
2022-09-24 08:23:36 -07:00
Harley Acheson cd1631b17d BLF: Refactor of DPI
Correction of U.dpi to hold actual monitor DPI. Simplify font sizing by
omitting DPI as API argument, always using 72 internally.

See D15961 for more details.

Differential Revision: https://developer.blender.org/D15961

Reviewed by Campbell Barton
2022-09-23 17:36:49 -07:00
Campbell Barton dc06bf2cb6 Fix crash loading fonts that fail to be read
Null pointer dereference since [0] when font's can't be read.

[0]: d39abb74a0
2022-09-22 22:11:09 +10:00
Campbell Barton 95f05a6a4b Cleanup: spelling in comments 2022-09-16 18:14:33 +10:00
Harley Acheson 1a48548980 BLF: Incorrect Define Used
Replace incorrect usage of GLYPH_ASCII_TABLE_SIZE with correct
KERNING_CACHE_TABLE_SIZE

See D15815 for more details.

Differential Revision: https://developer.blender.org/D15815

Own Code.
2022-09-14 09:57:54 -07:00
Harley Acheson da9e685e26 Fix T100823: Do Not Load Non-Scalable Fonts
Do not allow the loading of old-style non-scalable fonts.

See D15884 for more details.

Differential Revision: https://developer.blender.org/D15884

Reviewed by Brecht Van Lommel
2022-09-06 09:48:41 -07:00
Campbell Barton 6c6a53fad3 Cleanup: spelling in comments, formatting, move comments into headers 2022-09-06 16:25:20 +10:00
Clément Foucault 99afbc40e7 Cleanup: Fix clang-tidy warnings: [bugprone-suspicious-memory-comparison] 2022-09-02 20:34:37 +02:00
Harley Acheson 1a641b449a BLF: Replacement of Hebrew Font
Replacement of our Hebrew font, which has bad variable weight default.

See D15846 for more details.

Differential Revision: https://developer.blender.org/D15846

Reviewed by Brecht Van Lommel
2022-09-02 10:54:03 -07:00
Campbell Barton cae50c83c6 Cleanup: split font datafile loading into a function
Also use more descriptive/conventional variable names.
2022-08-31 12:50:08 +10:00
Campbell Barton 657b92c888 BLF: use existing stat from 'direntry' for directory check 2022-08-31 12:42:41 +10:00
Harley Acheson d81e947c59 BLF: Fallback Stack Error Handling
Properly handle invalid fonts.

See D15798 for more details

Differential Revision: https://developer.blender.org/D15798

Reviewed by Brecht Van Lommel
2022-08-30 11:31:11 -07:00
Campbell Barton 7269ee4dbb Cleanup: use const FontBLF arguments 2022-08-28 20:46:53 +10:00