Commit Graph
21 Commits
Author SHA1 Message Date
Dale Cieslak 88f36b2dd9 FontManagerBase: remove families from BObject list when deleting them
possibly related to #18169

Change-Id: If878109e7d739494d71ff97447de6bdeaa9f905d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6056
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2023-02-10 19:13:10 +00:00
Dale Cieslak 4f52a155e6 BFont: Minor code cleanup and autolocking for AppFontManager
* changed explicit locking to use Autolocker for gFontManager/fAppFontManager
in ServerApp, per comments in https://review.haiku-os.org/c/haiku/+/4790
* changed BFont::LoadFont (memory version) to use size_t for size and offset
* no functional changes

Change-Id: I438a4975d5bb1b2fa17bc54e9e171c31dadfeec5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6003
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2023-02-06 09:21:12 +00:00
Dale Cieslak 85b82f8524 BFont: allow loading of user fonts from disk or memory
This patch adds an API call to BFont, called LoadFont, that
takes a string path to a font file. The user fonts are managed
via a new class called AppFontManager that inherits from the base
class FontManagerBase but adds the methods to add and remove user
fonts from disk or memory. There is also a new method called UnloadFont
to remove a user font, but on exit of an app all user fonts should be
automatically cleaned up.

Global/system fonts are managed by the GlobalFontManager, which is
a new class that also inherits from the base class FontManagerBase,
replacing the old "FontManager" class.

A maximum of 128 user fonts may be loaded, and memory fonts
may not exceed 20MB.

There's also an overloaded version of LoadFont that accepts
an area_id and loads the font from memory. A size and offset may
optionally be provided to allow for an area that contains more
than just a font.

Change-Id: I6add42bdf0c0cefc0e2e2a4984fd848c3e7269e5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4790
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2022-12-17 12:32:09 +00:00
Dale Cieslak 094079b8c5 BFont: Implement BFont::BoundingBox
Extracted as separate patch from CR 4790; implement BFont::BoundingBox
as it was in BeOS. Returns a BRect that encloses any character in a
font, scaled by the font size.

Since the FreeType bbox is only valid for vector outlines, for bitmap
fonts, return a BRect with the dimensions of the bitmap font that is
closest to the font size.

Tested with CharacterMap. Will update CharacterMap to use the bounding
box once this change is landed.

Note that bitmap font rendering doesn't appear to work at all.

Change-ID: I8fc42ca0ddc0c77e04e0216001cd17e086ec7495
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5431
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2022-07-12 16:08:46 +00:00
Dale Cieslak 143253c873 DeskCalc: Fix Locale-aware display
Expression parser was made aware of Locale-specific separators in
hrev56067. However, the Expression view was still using only '.' as
separator. This change passes the Locale-specific decimal separator
to the ExpressionTextView class and uses that to parse the value for
display.

Fixes #17754

Change-Id: I7386eed51afe929a9b3eee69334f9199a3d06c4a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5338
Reviewed-by: Jérôme Duval <[email protected]>
2022-05-25 06:22:21 +00:00
Dale Cieslak d39b5bfd0c DeskCalc: make input Locale-aware
Accepts input with separators based on user's Locale.  For example,
with a European locale, "1.234,56" is valid input. With a US locale,
"1,234.56" is accepted.  The grouping separator is ignored and
removed, and the decimal separator is kept.

Supports multi-byte decimal separator and grouping separators.

The keypad localization is based on the user's Language setting,
but the separators come from the Formatting. Thus if the Language
is set to English, but the Formatting is set to, for example,
German, the keypad will show '.', but when pressed it will emit
',' to match the number Formatting. Otherwise the keypad breaks
the localized formatting.

Fixes #8503

Change-Id: I0d112bdca67a4e4898e37062102343194ed47f8f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4965
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2022-04-25 20:57:20 +00:00
Dale Cieslak 2398586d63 Pairs: reset IsFirstClick to true for New game
Reset the value of IsFirstClick to true whenever a new game is
started. Without this fix the board gets confused if there is
a card flipped when a game is restarted.

I can't reproduce any of the other oddities in the ticket but
this fixes the egregious repro case mentioned.

Fixes #6932

Change-Id: Ie5cedd7fc2ca411db722d3c24f68fe9aa48f7b5f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5038
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2022-03-02 22:42:05 +00:00
Dale Cieslak 5f61e00ab6 Add-Ons/Translators: Set About text for JPEG & JPEG2000 to B_PANEL_TEXT_COLOR
The body text on the About tabs for the JPEG & JPEG2000 translators are
BTextViews and so the default fg color is B_DOCUMENT_TEXT_COLOR. This
patch forces them to use B_PANEL_TEXT_COLOR to match the rest of the panel.

As a side note, trying to set the fg color in every translator via
SetHighUIColor seems to have no effect and they seem to all default to
using B_PANEL_TEXT_COLOR already (aside from the BTextViews in this
commit).

Fixes #15941

Change-Id: Ia97dcce082d7f1666c61a8d5ecefa3bcd5845b96
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4960
Reviewed-by: waddlesplash <[email protected]>
2022-02-18 21:29:46 +00:00
dsizzle d1f10fcef9 Added missing --cross-tools-source argument name for bootstrap build and missing \ at the end of line 136
Change-Id: Ie4a6d47d78a1f2eb707c15a53335adee7e370376
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4745
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2021-12-02 08:05:50 +00:00
dsizzle 7124ff96d3 Character Map: Added larger character popup on left-click
Fixes #15983.

Added left-click support to the existing function that pops up the context
menu for copying characters.  Instead of menu options, put a large version
of the currently-selected character in the popup on left-click.  The popup
character is 2.5 times as large as the current font size, because that
seemed nicer than 2 times.

Right-click functionality is unchanged.

Change-Id: I3b64fff3cafc02e2c54e34db6e58461b4e08b3b9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2832
Reviewed-by: Adrien Destugues <[email protected]>
2021-03-19 10:18:21 +00:00
dsizzle a15387c9e9 Character Map: Updated blocks for Unicode 13
Addresses part of #15595.

Added all of the missing blocks so that the full Unicode 13 set is
represented.

Change-Id: I3f54cb5dfba14050745287a7a36b22ad3d957b91
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2816
Reviewed-by: Axel Dörfler <[email protected]>
2020-05-27 12:56:36 +00:00
Dale Cieslak 8d3f6fce57 CharacterMap: gray out blocks that aren't supported by the current font
Fixes #15982.

Added font to UnicodeBlockView. Cache Unicode "Blocks" for both
UnicodeBlockView and CharacterView.  Added lookup of non-Be Unicode blocks
(i.e. blocks with 'kNoBlock' specified). Gray out non-found blocks.

NOTE: tested fontconfig extensively in another environment and the shown
blocks match what fontconfig returns.  However, you may sometimes see
characters in blocks that aren't 'included' in a font.  I haven't figured
out why that occurs.

Change-Id: Ia3c7f8ccc6dc43c5ce062ed002846c861a8fa223
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2739
Reviewed-by: Axel Dörfler <[email protected]>
2020-05-24 09:25:20 +00:00
Dale Cieslak 1939021364 CharacterMap: Use binary searches rather than linear lookups where possible.
UnicodeBlockView::SelectBlockForCharacter and CharacterView::_FrameFor
use the same linear search to find which block a character is in, so I
refactored both to use a shared BlockForCharacter function in UnicodeBlocks.cpp
that is a binary search. CharacterView::_BlockAt also had a TODO comment to
use a binary search, so I rewrote it as a binary search. It's not the same
search as the aforementioned BlockForCharacter function. These two changes
ought to improve the overall performance of CharacterMap.

Signed-off-by: Augustin Cavalier <[email protected]>
2017-11-13 16:33:21 +01:00
Dale Cieslak 061b9eeccf Memory leaks and locking issues in GetUnicodeBlocks and IncludesUnicodeBlock
- GetTransformedFace *must* be paired with PutTransformedFace otherwise
the font style never gets unlocked.
- Also use FcCharSetDestroy when done with a fontconfig charset to
prevent leaked memory.

Signed-off-by: Adrien Destugues <[email protected]>

ticket: #13526
2017-07-02 08:38:58 +02:00
Dale Cieslak 33c9787d10 Fixes #13526 so that BFont::Blocks properly set bitmask for Unicode blocks in a font.
ParseFcMap had several logic errors.
- fixed variable being initialized in the wrong part of the loops
- fixed problem of ANDing bit with 0x8 instead of 0x1
- changed some variable names; 'foundStartBlock' implies a boolean but
it is a block number, so it is now just 'startBlock'
- added const BITS_PER_BLOCK for magic number 32
- added short-circuit for empty full or partial blocks
- initialized variables to -1 when 0 is a valid value
- added code to handle when the end of a block is reached and a range
was started but never finished.

Signed-off-by: Adrien Destugues <[email protected]>

Fixes #13526
2017-05-22 20:53:12 +02:00
dsizzle 9b6b158b88 Implementation of BFont::Blocks
BFont::Blocks is now implemented in ServerFont, via a call through the
app_server.  It uses fontconfig to iterate through a charset of a font
and stores the defined blocks in a bitmap.

A new API was added, BFont::IncludesBlock, that will allow for arbitrary
testing of a given Unicode block. Since nothing is cached, searching
through an entire charset for a series of Unicode blocks can be quite
slow. In a given block there may be only 1 or 2 characters actually
defined so every character within a block needs to be checked until one
is found, which in a degenerate case will mean the entire block is
checked.

Signed-off-by: Axel Dörfler <[email protected]>
2017-05-08 22:17:53 +02:00
dsizzle 0340e4b336 CharacterMap: several fixes to char. view scroll
* Select items in the encoding list by block identifier rather than
list index (there are holes in the list)
* Scroll to the start of the list when the application starts
* Add and use IsBlockVisible to detect when we need to make a block
visible, avoiding unwanted scrollings in some cases with the previous
method of testing for only one character in the block.

Signed-off-by: Adrien Destugues <[email protected]>

Fixes some problems with previous enhancements from #3651.
2014-11-27 08:50:37 +01:00
dsizzle b8a8557aa9 CharacterMap: use dynamic font menu
* only update if font family update is detected.
* character map can now detect new fonts or removed fonts without
restarting

Signed-off-by: Adrien Destugues <[email protected]>

Fixes #3651 part 7.
2014-11-27 08:31:18 +01:00
dsizzle d67977a5ae CharacterMap: avoid jumping window size
set explicit minimum width of character view to be a bit larger than
fCodeView so that there isn't jumping of the pane sizes when fCodeView's
contents are too long

Signed-off-by: Adrien Destugues <[email protected]>

Fixes #3651 part 9.
2014-11-26 08:34:05 +01:00
dsizzle c3205c10d7 CharacterMap: show font family and style
Signed-off-by: Adrien Destugues <[email protected]>

Fixes #3651 item 2.
2014-11-26 08:34:04 +01:00
dsizzle 74d9b875c2 CharacterMap: select Unicode block for current character
* Scrolling the list of characters now selects the currently visible
block in the blocks list.

Signed-off-by: Adrien Destugues <[email protected]>

Fixes #3651, part 1
2014-11-25 08:30:08 +01:00