Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-05-06Cleanup: spelling in comments, use doxygen commentsCampbell Barton
2022-04-14Fix T97310: BLF Line Height While Text WrappingHarley Acheson
Fix word-wrapped tooltip text not showing by aligning to pixel grid. See D14639 for more details. Differential Revision: https://developer.blender.org/D14639 Reviewed by Campbell Barton
2022-04-13Cleanup: warning for 'float' to 'int' with MSVCCampbell Barton
2022-04-13Cleanup: avoid redundant float/int conversions in BLFCampbell Barton
Internally many offsets for BLF were integers but exposed as floats, since these are used in pixel-space, many callers were converging them back to integers. Simplify logic by using ints.
2022-04-13BLF: sub-pixel positioning supportCampbell Barton
Support sub-pixel kerning and hinting for future support for improved character placement. No user visible changes have been made. - Calculate sub-pixel offsets, using integer maths. - Use convenience functions to perform the conversions and hide the underlying values. - Use `ft_pix` type to distinguish values that use sub-pixel integer values from freetype and values rounded to pixels. This was originally based on D12999 by @harley with the user visible changes removed so they can be applied separately.
2022-04-04Cleanup: ensure space after file named in headersCampbell Barton
Add blank lines after file references to avoid them being interpreted as doc-strings the following declarations.
2022-03-25Cleanup: use count or num instead of nbrCampbell Barton
Follow conventions from T85728.
2022-03-25BLF Cleanup: Use FreeType Enum FT_Err_OkHarley Acheson
Replace comparisons of FT_Error against 0 with FT_Err_Ok instead. See D14052 for more details. Differential Revision: https://developer.blender.org/D14052 Reviewed by Campbell Barton
2022-03-24Cleanup: use "filepath" instead of "filename" for full pathsCampbell Barton
Reserve "filename" when only the name component is used.
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2022-02-08BLF: Enable Filtering of woff and woff2 FontsHarley Acheson
Add files with extension ".woff" and ".woff2" to FILE_TYPE_FTFONT file type. Allows selecting and using these types of font files. See D13822 for more details. Differential Revision: https://developer.blender.org/D13822 Reviewed by Campbell Barton
2022-02-05BLF: Cleanup blf_glyph_cache_find & blf_font_sizeHarley Acheson
Removes unnecessary calls to blf_glyph_cache_find, simplifies blf_font_size, and reduces calls to it. blf_glyph_cache_new and blf_glyph_cache_find made static. See D13374 for more details. Differential Revision: https://developer.blender.org/D13374 Reviewed by Campbell Barton
2022-02-05BLF: Default Size as FloatHarley Acheson
Allowing setting and storing of the default font size as float. See D13230 for more details. Differential Revision: https://developer.blender.org/D13230 Reviewed by Campbell Barton
2022-02-05BLF: Removal of blf_font_draw_ascii DeclarationHarley Acheson
Removal of declaration of unused blf_font_draw_ascii See D13624 for more details. Differential Revision: https://developer.blender.org/D13624 Reviewed by Campbell Barton
2022-02-05BLF: Save fixed_width value in cacheHarley Acheson
Cache the font size's ideal fixed width column size in the glyph cache rather than the font itself to improve performance. See D13226 for more details. Differential Revision: https://developer.blender.org/D13226 Reviewed by Campbell Barton
2022-02-05BLF: blf_glyph_cache_free Made StaticHarley Acheson
blf_glyph_cache_free does not need to be public. See D13395 for more details. Differential Revision: https://developer.blender.org/D13395 Reviewed by Campbell Barton
2022-01-30Cleanup: Cmake: remove unnecessary definitions for internationalizationAaron Carlisle
Previously, macros were ifdefed using the cmake option `WITH_INTERNATIONAL` However, the is unnecessary as withen the functions themselves have checks for building without internationalization. This also means that many `add_definitions(-DWITH_INTERNATIONAL)` are also unnecessary. Reviewed By: mont29, LazyDodo Differential Revision: https://developer.blender.org/D13929
2022-01-26Revert "CMake: include BROTLI_LIBRARIES in FREETYPE_LIBRARIES on UNIX"Campbell Barton
This reverts commit 086f1911698154edd4cc19dc966e966bb0060917. There was apparently a problem using APPEND which wasn't referenced in the commit log. Added comment noting the reason for the discrepancy.
2022-01-26CMake: include BROTLI_LIBRARIES in FREETYPE_LIBRARIES on UNIXCampbell Barton
This was already done for APPLE & WIN32, which would reference these libraries twice. Now append BROTLI_LIBRARIES to FREETYPE_LIBRARIES when they're required for linking. No functional changes as all references to FREETYPE_LIBRARIES also used BROTLI_LIBRARIES.
2022-01-25CMake/Linux: find Brotli library the proper waySybren A. Stüvel
Use a `FindBrotli.cmake` module instead of manually appending library paths. This is just for Linux; Windows and macOS will be reviewed separately.
2022-01-21Cmake/Deps: Freetype 2.11.0 / brotli 1.0.9Ray Molenkamp
The UI team requested adding woff2 support to freetype. this required a new dependency brotli. This changes adds brotili to the builder and bumps freetype to version 2.11.0 As freetype now depends on other libraries, for consistency all use of ${FREETYPE_LIBRARY} in cmake has been updated to use ${FREETYPE_LIBRARIES} adjustments have been made in the windows platform file, all other platforms use cmake's FindFreeType.cmake which already sets this variable. reviewed by: brecht Differential Revision: https://developer.blender.org/D13448
2022-01-12Revert "BLI: Refactor vector types & functions to use templates"Clément Foucault
Includes unwanted changes This reverts commit 46e049d0ce2bce2f53ddc41a0dbbea2969d00a5d.
2022-01-12BLI: Refactor vector types & functions to use templatesClment Foucault
This patch implements the vector types (i.e:`float2`) by making heavy usage of templating. All vector functions are now outside of the vector classes (inside the `blender::math` namespace) and are not vector size dependent for the most part. In the ongoing effort to make shaders less GL centric, we are aiming to share more code between GLSL and C++ to avoid code duplication. ####Motivations: - We are aiming to share UBO and SSBO structures between GLSL and C++. This means we will use many of the existing vector types and others we currently don't have (uintX, intX). All these variations were asking for many more code duplication. - Deduplicate existing code which is duplicated for each vector size. - We also want to share small functions. Which means that vector functions should be static and not in the class namespace. - Reduce friction to use these types in new projects due to their incompleteness. - The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a bit of a let down. Most clases are incomplete, out of sync with each others with different codestyles, and some functions that should be static are not (i.e: `float3::reflect()`). ####Upsides: - Still support `.x, .y, .z, .w` for readability. - Compact, readable and easilly extendable. - All of the vector functions are available for all the vectors types and can be restricted to certain types. Also template specialization let us define exception for special class (like mpq). - With optimization ON, the compiler unroll the loops and performance is the same. ####Downsides: - Might impact debugability. Though I would arge that the bugs are rarelly caused by the vector class itself (since the operations are quite trivial) but by the type conversions. - Might impact compile time. I did not saw a significant impact since the usage is not really widespread. - Functions needs to be rewritten to support arbitrary vector length. For instance, one can't call `len_squared_v3v3` in `math::length_squared()` and call it a day. - Type cast does not work with the template version of the `math::` vector functions. Meaning you need to manually cast `float *` and `(float *)[3]` to `float3` for the function calls. i.e: `math::distance_squared(float3(nearest.co), positions[i]);` - Some parts might loose in readability: `float3::dot(v1.normalized(), v2.normalized())` becoming `math::dot(math::normalize(v1), math::normalize(v2))` But I propose, when appropriate, to use `using namespace blender::math;` on function local or file scope to increase readability. `dot(normalize(v1), normalize(v2))` ####Consideration: - Include back `.length()` method. It is quite handy and is more C++ oriented. - I considered the GLM library as a candidate for replacement. It felt like too much for what we need and would be difficult to extend / modify to our needs. - I used Macros to reduce code in operators declaration and potential copy paste bugs. This could reduce debugability and could be reverted. - This touches `delaunay_2d.cc` and the intersection code. I would like to know @howardt opinion on the matter. - The `noexcept` on the copy constructor of `mpq(2|3)` is being removed. But according to @JacquesLucke it is not a real problem for now. I would like to give a huge thanks to @JacquesLucke who helped during this and pushed me to reduce the duplication further. Reviewed By: brecht, sergey, JacquesLucke Differential Revision: https://developer.blender.org/D13791
2022-01-12Revert "BLI: Refactor vector types & functions to use templates"Clément Foucault
Reverted because the commit removes a lot of commits. This reverts commit a2c1c368af48644fa8995ecbe7138cc0d7900c30.
2022-01-12BLI: Refactor vector types & functions to use templatesClément Foucault
This patch implements the vector types (i.e:float2) by making heavy usage of templating. All vector functions are now outside of the vector classes (inside the blender::math namespace) and are not vector size dependent for the most part. In the ongoing effort to make shaders less GL centric, we are aiming to share more code between GLSL and C++ to avoid code duplication. Motivations: - We are aiming to share UBO and SSBO structures between GLSL and C++. This means we will use many of the existing vector types and others we currently don't have (uintX, intX). All these variations were asking for many more code duplication. - Deduplicate existing code which is duplicated for each vector size. - We also want to share small functions. Which means that vector functions should be static and not in the class namespace. - Reduce friction to use these types in new projects due to their incompleteness. - The current state of the BLI_(float|double|mpq)(2|3|4).hh is a bit of a let down. Most clases are incomplete, out of sync with each others with different codestyles, and some functions that should be static are not (i.e: float3::reflect()). Upsides: - Still support .x, .y, .z, .w for readability. - Compact, readable and easilly extendable. - All of the vector functions are available for all the vectors types and can be restricted to certain types. Also template specialization let us define exception for special class (like mpq). - With optimization ON, the compiler unroll the loops and performance is the same. Downsides: - Might impact debugability. Though I would arge that the bugs are rarelly caused by the vector class itself (since the operations are quite trivial) but by the type conversions. - Might impact compile time. I did not saw a significant impact since the usage is not really widespread. - Functions needs to be rewritten to support arbitrary vector length. For instance, one can't call len_squared_v3v3 in math::length_squared() and call it a day. - Type cast does not work with the template version of the math:: vector functions. Meaning you need to manually cast float * and (float *)[3] to float3 for the function calls. i.e: math::distance_squared(float3(nearest.co), positions[i]); - Some parts might loose in readability: float3::dot(v1.normalized(), v2.normalized()) becoming math::dot(math::normalize(v1), math::normalize(v2)) But I propose, when appropriate, to use using namespace blender::math; on function local or file scope to increase readability. dot(normalize(v1), normalize(v2)) Consideration: - Include back .length() method. It is quite handy and is more C++ oriented. - I considered the GLM library as a candidate for replacement. It felt like too much for what we need and would be difficult to extend / modify to our needs. - I used Macros to reduce code in operators declaration and potential copy paste bugs. This could reduce debugability and could be reverted. - This touches delaunay_2d.cc and the intersection code. I would like to know @Howard Trickey (howardt) opinion on the matter. - The noexcept on the copy constructor of mpq(2|3) is being removed. But according to @Jacques Lucke (JacquesLucke) it is not a real problem for now. I would like to give a huge thanks to @Jacques Lucke (JacquesLucke) who helped during this and pushed me to reduce the duplication further. Reviewed By: brecht, sergey, JacquesLucke Differential Revision: http://developer.blender.org/D13791
2022-01-12Cleanup: remove redundant const qualifiers for POD typesCampbell Barton
2022-01-07Cleanup: remove redundant const qualifiers for POD typesCampbell Barton
MSVC used to warn about const mismatch for arguments passed by value. Remove these as newer versions of MSVC no longer show this warning.
2021-12-08Cleanup: move public doc-strings into headers for 'blenfont'Campbell Barton
Ref T92709
2021-11-19Cleanup: fix typos in comments and docsBrecht Van Lommel
Contributed by luzpaz. Differential Revision: https://developer.blender.org/D13264
2021-11-13BLF: Use Floats for Font Point SizesHarley Acheson
Allow the use of floating-point values for font point sizes, which allows greater precision and flexibility for text output. See D8960 for more information, details, and justification. Differential Revision: https://developer.blender.org/D8960 Reviewed by Campbell Barton
2021-11-08Cleanup: use doxygen for BLF glyphCampbell Barton
- Use doxy formatted functions. - Use doxy sections.
2021-11-06BLF: Refactor blf_glyph.cHarley Acheson
Cleanup and Simplification of blf_glyph.c See D13095 for details. Differential Revision: https://developer.blender.org/D13095 Reviewed by Campbell Barton
2021-11-06Cleanup: remove window_manager & editor includes from BLFCampbell Barton
Remove the need to include the window manager & editor functions in low level font rendering code. - The default font size is now set when changed in the preferences. - Flushing cache is set as a callback.
2021-11-05Cleanup (UI): Add/use type for operator context enumJulian Eisel
Adds a `wmOperatorCallContext` typedef for the existing `WM_OP_XXX` operator context enum. This adds type safety, allows the compiler to produce better warnings and helps understanding what a variable is for. Differential Revision: https://developer.blender.org/D13113 Reviewed by: Campbell Barton
2021-11-03BLF: Remove Thread Locking For Font MetricsHarley Acheson
This patch removes the need to lock the thread just to get to some generic (not glyph-specific) font metrics. See D12976 for more details. Differential Revision: https://developer.blender.org/D12976 Reviewed by Campbell Barton
2021-10-29Cleanup: rename blf_utf8_next_fast to blf_glyph_from_utf8_and_stepCampbell Barton
Calling this 'fast' no longer made sense as the slower code-path has been removed.
2021-10-29Cleanup: remove redundant BLI_UTF8_ERR checkCampbell Barton
2021-10-29Cleanup: resolve cast warningsCampbell Barton
2021-10-29BLF Refactor: blf_utf8_next_fastHarley Acheson
Simplification of BLF glyph loading See D13026 for details. Differential Revision: https://developer.blender.org/D13026 Reviewed by Campbell Barton
2021-10-29BLF Refactor: blf_kerning_step_fastHarley Acheson
Simplification of BLF Kerning See D13015 for more details. Differential Revision: https://developer.blender.org/D13015 Reviewed by Campbell Barton
2021-10-06Cleanup: spelling in commentsCampbell Barton
2021-08-28BLF: remove checks for blend file relative pathsCampbell Barton
This was added in b24712a9ca6fa807660a02d6988269748daecdbf but is no longer needed as of efc129bc827558e55cf4619b8e2ca502342338f3. Further, this wasn't reliable as it could fail on linked library data which has a different base directory. Assert when blend file relative paths are passed to BLF (matching imbuf file loading).
2021-08-27Cleanup: utf8 stepping functionsCampbell Barton
Various changes to reduce risk of out of bounds errors in utf8 seeking. - Remove BLI_str_prev_char_utf8 This function could potentially scan past the beginning of a string. Use BLI_str_find_prev_char_utf8 instead which takes a limiting string start argument. - Swap arguments for BLI_str_find_prev_char_utf8 so the stepping argument is first and the limiting argument is last. This matches BLI_str_find_next_char_utf8. - Change behavior of these functions to return it the start or end pointers instead of NULL, which complicated use of these functions to calculate offsets. Callers that need to check if the limits were reached can compare the return value with the start/end pointers. - Return 'const char *' from these functions so they don't remove const from the input arguments.
2021-08-26Cleanup: spelling in commentsCampbell Barton
2021-08-25BLF: Remove ASCII-only Code PathsHarley Acheson
Remove redundant code for drawing text strings that contain only ASCII. See D12293 for much more detail. Differential Revision: https://developer.blender.org/D12293 Reviewed by Campbell Barton
2021-08-25BLI_string_utf8: simplify utf8 stepping logicCampbell Barton
There were multiple utf8 functions which treated errors slightly differently. Split BLI_str_utf8_as_unicode_step into two functions. - BLI_str_utf8_as_unicode_step_or_error returns error value when decoding fails and doesn't step. - BLI_str_utf8_as_unicode_step always steps forward at least one returning the byte value without decoding (needed to display some latin1 file-paths). Font drawing uses BLI_str_utf8_as_unicode_step and no longer check for error values.
2021-08-24Fix BLI_str_utf8_as_unicode_step reading past intended boundsCampbell Barton
Add a string length argument to BLI_str_utf8_as_unicode_step to prevent reading past the buffer bounds or the intended range since some callers of this function take a string length to operate on part of the string. Font drawing for example didn't respect the length argument, potentially causing a buffer over-read with multi-byte characters that could read past the end of the string. The following command would read 5 bytes past the end of the input. `BLF_draw(font_id, (char[]){252}, 1);` In practice strings are typically null terminated so this didn't crash reading past buffer bounds. Nevertheless, this wasn't correct and could cause bugs in the future. Clamping by the length now has the same behavior as a null byte. Add test to ensure this is working as intended.
2021-08-24Cleanup: spellingCampbell Barton
2021-08-23Cleanup: rename len to str_len for BLF functionsCampbell Barton
Make it obvious which variable this is the length of.
2021-08-21Cleanup: minor changes to blf_font.cCampbell Barton
- Use early return when kerning isn't used. - Remove early return that prevented matching acquire/release calls.