MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / Style_StrGetSize

Function Style_StrGetSize

src/Styles.c:2451–2482  ·  view source on GitHub ↗

============================================================================= Style_StrGetSize()

Source from the content-addressed store, hash-verified

2449// Style_StrGetSize()
2450//
2451BOOL Style_StrGetSize ( LPCWSTR lpszStyle, int *i )
2452{
2453 WCHAR tch[256];
2454 WCHAR *p;
2455 int iValue;
2456 int iSign = 0;
2457 int itok;
2458 if ( p = StrStrI ( lpszStyle, L"size:" ) ) {
2459 lstrcpy ( tch, p + CSTRLEN ( L"size:" ) );
2460 if ( tch[0] == L'+' ) {
2461 iSign = 1;
2462 tch[0] = L' ';
2463 } else if ( tch[0] == L'-' ) {
2464 iSign = -1;
2465 tch[0] = L' ';
2466 }
2467 if ( p = StrChr ( tch, L';' ) ) {
2468 *p = L'\0';
2469 }
2470 TrimString ( tch );
2471 itok = swscanf ( tch, L"%i", &iValue );
2472 if ( itok == 1 ) {
2473 if ( iSign == 0 ) {
2474 *i = iValue;
2475 } else {
2476 *i = max ( 0, iBaseFontSize + iValue * iSign ); // size must be +
2477 }
2478 return TRUE;
2479 }
2480 }
2481 return FALSE;
2482}
2483
2484
2485//=============================================================================

Callers 3

Style_SetLexerFunction · 0.85
Style_SelectFontFunction · 0.85
Style_SetStylesFunction · 0.85

Calls 1

TrimStringFunction · 0.85

Tested by

no test coverage detected