Separate user configuration of subpixel antialiasing from the hinting
options. For example, this allows turning this on while hinting is
"None", or off when hinting is "Full".
Pull Request: https://projects.blender.org/blender/blender/pulls/113027
There should be no Subpixel AA if the user has deselected
"Anti-Aliasing". Render target FT_LOAD_TARGET_MONO is strongly
hinted to pixel grid and shouldn't be messed with.
Pull Request: https://projects.blender.org/blender/blender/pulls/112759
Without this it was necessary to convert pasted text into spaces
for them to display properly.
Since tabs are a valid part of a string, it's incorrect to assume
tabs can always be expanded to spaces.
Pasted text and console output now display tabs properly,
the tab still uses spaces for indenting though.
Make type conversions explicit so it's clear when char/char32_t/uint
values are being mixed, also use int instead of size_t for cursor
functions because the cursor is an int - which caused many int/size_t
comparisons.
Slight corrections to embolden, mostly removing any vertical expansion
and better matching "wght" variable axis. Also improved comments for
all the glyph transform routines.
Pull Request: https://projects.blender.org/blender/blender/pulls/112592
This makes it clearer other "safe" functions should be used in
combination with the resulting offsets.
Also correct doc-string which wasn't updated from the "or_error()"
version of this function.
There were enough cases of callers ignoring a potential the error value,
using the column width for e.g. to calculate pixel sizes, or the size in
bytes to calculate buffer offsets.
Since text fields & labels can include characters that return an error
from BLI_str_utf8_as_unicode, add the suffix to make this explicit.
It wasn't possible to select the position between two tab characters
with the mouse cursor in the UI. Don't handle characters with an unknown
width as combining.
Follow up to [0] which changed this for cursor motion.
[0]: bc51449ff1
The result of BLI_wcwidth wasn't checked before using the result to
calculate a width, this cause a negative return value to be multiplied
by the font size which divided by zero.
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.
Using ClangBuildAnalyzer on the whole Blender build, it was pointing
out that BLI_math.h is the heaviest "header hub" (i.e. non tiny file
that is included a lot).
However, there's very little (actually zero) source files in Blender
that need "all the math" (base, colors, vectors, matrices,
quaternions, intersection, interpolation, statistics, solvers and
time). A common use case is source files needing just vectors, or
just vectors & matrices, or just colors etc. Actually, 181 files
were including the whole math thing without needing it at all.
This change removes BLI_math.h completely, and instead in all the
places that need it, includes BLI_math_vector.h or BLI_math_color.h
and so on.
Change from that:
- BLI_math_color.h was included 1399 times -> now 408 (took 114.0sec
to parse -> now 36.3sec)
- BLI_simd.h 1403 -> 418 (109.7sec -> 34.9sec).
Full rebuild of Blender (Apple M1, Xcode, RelWithDebInfo) is not
affected much (342sec -> 334sec). Most of benefit would be when
someone's changing BLI_simd.h or BLI_math_color.h or similar files,
that now there's 3x fewer files result in a recompile.
Pull Request #110944
The cleanup of blenkernel last weeks , caused the house of cards to
collapse on top of bf_gpu's shader_builder, which is off by default
but used on a daily basis by the rendering team.
Given the fixes forward in #110394 ran into a ODR violation in OSL that
was hiding there for years, I don't see another way forward without
impeding the rendering teams productivity for "quite a while" as there
is no guarantee the OSL issue would be the end of it.
the only way forward appears to be back.
this reverts :
19422044eda670b53abe0f541db97cbe516e8c813e88a2f44c4e64b772f59547e7a31707fe6c5a57
The problematic commit was 07fe6c5a57
as blenkernel links most of blender, it's a bit of a link order issue
magnet. Given all these commits stack, it's near impossible to revert
just that one without spending a significant amount of time resolving
merge conflicts. 99% of that work was automated, so easier to just
revert all of them, and re-do the work, than it is to deal with the
merge conflicts.
Pull Request: https://projects.blender.org/blender/blender/pulls/110438
There's quite a few libraries that depend on dna_type_offsets.h
but had gotten to it by just adding the folder that contains it to
their includes INC section without declaring a dependency to
bf_dna in the LIB section.
which occasionally lead to the lib building before bf_dna and the
header being missing, while this generally gets fixed in CMake by
adding bf_dna to the LIB section of the lib, however until last
week all libraries in the LIB section were linked as INTERFACE so
adding it in there did not resolve the build issue.
To make things still build, we sprinkled add_dependencies wherever
we needed it to force a build order.
This diff :
Declares public include folders for the bf_dna target so there's
no more fudging the INC section required to get to them.
Removes all dna related paths from the INC section for all
libraries.
Adds an alias target bf:dna to signify it has been updated to
modern cmake
Declares a dependency on bf::dna for all libraries that require it
Removes (almost) all calls to add_dependencies for bf_dna
Future work:
Because of the manual dependency management that was done, there is
now some "clutter" with libs depending on bf_dna that realistically
don't. Example bf_intern_opencolorio itself has no dependency on
bf_dna at all, doesn't need it, doesn't use it. However the
dna include folder had been added to it in the past since bf_blenlib
uses dna headers in some of its public headers and
bf_intern_opencolorio does use those blenlib headers.
Given bf_blenlib now correctly declares the dependency on bf_dna
as public bf_intern_opencolorio will get the dna header directory
automatically from CMake, hence some cleanup could be done for
bf_intern_opencolorio
Because 99% of the changes in this diff have been automated, this diff
does not seek to address these issues as there is no easy way to
determine why a certain dependency is in place. A developer will have
to make a pass a this at some later point in time. As I'd rather not
mix automated and manual labour.
There are a few libraries that could not be automatically processed
(ie bf_blendthumb) that also will need this manual look-over.
Pull Request: https://projects.blender.org/blender/blender/pulls/109835
A lot of files were missing copyright field in the header and
the Blender Foundation contributed to them in a sense of bug
fixing and general maintenance.
This change makes it explicit that those files are at least
partially copyrighted by the Blender Foundation.
Note that this does not make it so the Blender Foundation is
the only holder of the copyright in those files, and developers
who do not have a signed contract with the foundation still
hold the copyright as well.
Another aspect of this change is using SPDX format for the
header. We already used it for the license specification,
and now we state it for the copyright as well, following the
FAQ:
https://reuse.software/faq/
There is no reason to use case-sensitive path lookups on MS-Windows.
Also replace BLI_str_endswith with BLI_path_basename since ends-with
checks don't ensure a preceding path separator.
Loading a font in BLF would search a list of directory presets
however these presets were never used.
Remove them as all callers pass in full paths.
Also rename FontBLF::name to mem_name as it's only needed as an ID
for in-memory fonts (to prevent them being loaded multiple times).
Non-unique font loading now compares against the filepath or mem_name
when loading from files or memory (before both used `name` which was
often the filepath, sometimes the full ID-name).
- 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.
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.
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
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
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.
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
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
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
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
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.
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.
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.
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
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
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
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
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
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.
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
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