Calculation of FontFamily.Baseline in WPF
Hi,
I'm trying to reproduce in WPF the behavior of a Silverlight TextBlock, but the baseLineOffset is giving me problems.
The formula used by Silverlight looks quite easy:
max height of the characters in the font (aka Win Ascent) / Units per em * font size.
For example the Arial font have a Win Ascent of 1854 and is defined at 2048 units per em. So for a FontSize of 1 I get
1 * 1854 /2048 = 0.9053
But in WPF for the Arial font the FontFamily.Baseline is 0.9217
"Magically" in WPF the Arial font have an Ascent of 0.9053, but it doesn't work for all fonts. For example I'm often using a font called Tina Black.
In Silverlight it's BaseLineOffset is calculated as 1 * 800 / 1000 = 0.8
In WPF the FontFamily.Baseline is 0.8 also but the Ascent is 0.921875
Another example with the font "Salsbury" :
In Silverlight it's BaseLineOffset is calculated as 1 * 957 / 1000 = 0.957
In WPF the FontFamily.Baseline is 0.9706 and the Ascent is 0.921875
So my question is : What is the formula to calculate FontFamily.Baseline in WPF and/or calculate the BaseLineOffset found in Silvrlight ?
Thanks for your help.
Hello Sovitec,
Since .NET is now open source we can search for the result from this site:
http://referencesource.microsoft.com/
So when searching for FontFamily.Baseline
We can see this property:
/// <summary>
/// Distance from character cell top to English baseline relative to em size.
/// </summary>
public double Baseline
get
return FirstFontFamily.BaselineDesign;
set
VerifyMutable().SetBaseline(value);
And for BaselineDesign, we can see some related code and I think you can take them as your reference, for example:
/// <summary>
/// Distance from character cell top to English baseline relative to em size.
/// </summary>
public double Baseline(double emSize, double toReal, double pixelsPerDip, TextFormattingMode textFormattingMode)
if (textFormattingMode == TextFormattingMode.Ideal)
return ((IFontFamily)this).BaselineDesign * emSize;
else
// If the composite font has a pre specified Baseline then we respect it in calculating the
// baseline but we round it since Compatible metrics are pixel aligned.
if (_fontInfo.Baseline != 0)
return Math.Round(_fontInfo.Baseline * emSize);
// If the composite font has no specifed Baseline then we get the compatible font metrics of the
// first fontfamily in the composite font.
else
return GetFirstFontFamily().Baseline(emSize, toReal, pixelsPerDip, textFormattingMode);
http://referencesource.microsoft.com/#PresentationCore/Core/CSharp/MS/Internal/Shaping/CompositeFontFamily.cs,177
But actually I think you may interested in the formula about FormattedText.Baseline:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/4ea51d1b-84fb-42d3-ada3-afb776bd38d9/how-to-determine-the-baseline-of-a-formattedtext-object?forum=wpf
Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Similar Messages
-
Idoc INVOIC error Baseline date for payment does not exist
Dear All,
I am facing the following error message when processing an idoc to do an MM invoice reception (operation similar to a MIRO).
The payment term is correctly maintained in the purchase order.
Idoc message type INVOIC MM.
Baseline date for payment does not exist
Message no. M8356
Diagnosis
You have tried to post a document without a baseline date for payment.
The system will not allow you to do this.
Check the purchase order. No terms of payment have been entered in the document header or no suggestion has been defined in Customizing for the baseline date for payment for the terms of payment entered.
If you get the error message during automatic settlement of planned delivery costs, maintain the term of payment in the master record (Payment Transactions, Financial Accounting) for the freight vendor or use the Business Add-In MRM_ERS_HDAT_MODIFY to determine the term of payment.
Regards
ArnaudHello,
Date for starting the calculation of the baseline date is indeed managed in the TC OME2 (document date, posting date, etc..).
In my project, there is already some companies using payment term N60N, so it should be possible to continue using it.
I solved this issue by putting a payment term in the vendors master data (company & purchasing views) and also in the customers views (company / sales orga) otherwise the structure of the idoc is different.
Thanks anyway for your input.
Keep in touch.
Regards
Arnaud -
How to view baseline and updated project to show progress vs baseline
I know how to assign a baseline to a project but I cannot figure out how to view both to show my client the progress since the baseline. Does anyone know how to do this? Please HELP.....
FWBaseline management and reporting is a complex subject so I will start with basics not to confuse you.
Assign the baseline as project baseline.
Add a bar in gantt chart and select type project baseline, perhaps bar is already there and you need to just select it.
Add a column Schedule %age complete and that is your baseline %age as of current data date.
Note:
Please make sure the baseline used for EV under project settings - calculations is project baseline to get the right Sch. %age.
Jawad
Novo Rail, Sydney -
Liquidity forecast - purchase order payment terms
Dear Experts, I have the following issue,
We are using liquidity forecast, but we are having a problem because the system does not take into account when a Purchase Order is created with Installment Payment Conditions. The Liquidity Forecast shows the Planning Date equal to Delivery Date of the Purchase Order, not taking into account the division of the payment term and the days of delay of every partial payment. I would like to know if there is workaround for this issue.
Best regards.Hi Cristobal,
The splitting of payment commitmentment accrding to the instalment dates are not possible. However it is possible to have the first instalment payment date instead of delivery date. But for this the Payment Term definition should take the baseline date as any of the 3 defaults possible ( Doc date/Posting date/Entry date). That means it should not be "No Default".
Below reproduction from note 497381:
"In the installment payment terms, you can enter 'Fixed day' and 'Additional months' for the calculation of a baseline date. In this case, the system updates the entire payment commitment as at the calculated baseline date (fixed day and additional months)."
Please try this and also share your results with us
Shony -
Hi All,
Please let me know is there any function module or logic to determine duedate for invoice document.
Thanks in advance
VenkatHi,
Found this old post when I was searching how invoice due date is calculated (field INVFO-NETDT from transaction FV60).
The due date for net payment is calculated from the baseline date for payment and the maximum permissible target dates in the terms of payment. It is not stored in the document line item but is always recalculated during ABAP evaluations via logical data bases (on the basis of the current terms of payment) and displayed in this field.
After investigation in the system I see that the best way is to use function module 'DETERMINE_DUE_DATE'.
BR,
Anete -
Invoice Idocs - adding discounts
I am using basic type INVOIC01 to create an invoice idoc. But I can not get the idoc to work when using payment terms (segment E1EDK18). I am attempting to create an invoice with a discount by using payment terms, but the most common error I get is 'The baseline date does not exist'. Can any offer any help?
Here are the main segments I think are requried for the discount???
E1EDK03
QUALF 044 (baseline date)
DATE 20051123
E1EDK04
MWSKZ VS
MSATZ 17.50
MWSBT 15.75 (100 - 10% discount Then 17.5% of 90 = 15.75)
E1EDK18
QUALF 001
TAGE 30
PRZNT 10
ZTERM_TXT TEST1
E1EDS01
SUMID 005
SUMME 15.75 (total VAT)
WAERQ GBP
E1EDS01
SUMID 010
SUMME 100 (net total must be orig. 100 for payment run)
E1EDS01
SUMID 011
SUMME 115.75 (total)Hello,
I got the similar issue. see my post "Idoc INVOIC error Baseline date for payment does not exist"
Date for starting the calculation of the baseline date is indeed managed in the TC OME2 (document date, posting date, etc..).
I solved this issue by putting a payment term in the vendors master data (company & purchasing views) and also in the customers views (company / sales orga) otherwise the structure of the idoc is different.
Regards
Arnaud -
In the search I phone screen the messages aren't deleting if I type a contacts name ther still listed.
I would use a custom calculation script for each of the fields. Something like:
// Calculation script for Baseline year
(function () {
// Get the value of the WCPYear field
var v = getField("WPCYear").valueAsString;
// Set this field's value. Set to blank if WCPYear is empty
event.value = v ? v : "";
// Calculation script for 5-year goal field
(function () {
// Get the value of the WCPYear field
var v = getField("WPCYear").valueAsString;
// Set this field's value. Set to blank if WCPYear is empty
event.value = v ? +v + 5 : "";
// Calculation script for 10-year goal field
(function () {
// Get the value of the WCPYear field
var v = getField("WPCYear").valueAsString;
// Set this field's value. Set to blank if WCPYear is empty
event.value = v ? +v + 10 : ""; -
Hi,
We have a requirement to exclude non-Business days while calculating Baseline date(for the Accounting Document created on saving the Billing document)
Currently the Baseline Date being populated in the Accounting Document is Document date + 5days(including Holidays).
For eg
Current Scenario
Document Date: 12th Feb 2008
Baseline date: 17th feb 2008.
Requirement:
Document Date: 12th Feb 2008
Baseline date: 19th feb 2008(Excluding Sat & Sun).
Request you to share useful info in this regard.
Thanks
BinuHi,
Use user exit RV60FUS5 for these base line date calculations.
Thanks
Krishna. -
Baseline date calculation excluding non-Business days
Hi,
We have a requirement to exclude non-Business days while calculating Baseline date.
Currently the Baseline Date being populated in the Accounting Document is Document date + 5days(including Holidays).
For eg
Current Scenario
Document Date: 12th Feb 2008
Baseline date: 17th feb 2008.
Requirement:
Document Date: 12th Feb 2008
Baseline date: 19th feb 2008(Excluding Sat & Sun).
Request you to share useful info in this regard.
Thanks
BinuHi,
Use user exit RV60FUS5 for these base line date calculations.
Thanks
Krishna. -
Baseline date calculation in Invoice verification (MIRO)
Dear experts,
I need to set baseline date after 40 days from document date in MIRO.
Baseline date calculation of "Terms of Payment" in IMG has two parameters:
・Fixed day
・Additional months
We cannot set 40 days in these parameters.
Can anybody tell me how to set baseline date not month but date(not fixed day) ?
Please advise me on the settings SPRO>MM>Purchasing>Vendor Master>Define terms of Payment.
Thanks & Regards
KenHi,
You can't do this.
The baseline date is the date on which the calculations are made.
So if you have 40 days to pay, this will be 40 days from the baseline date.
This will either be the document date or another date, but you can't (in standard SAP) have the baseline date as "X" days after "Y".
So the baseline date is the date of an event (e.g. the date that the Invoice was posted) not a calculation.
Is it possible that you have misunderstood the use of this date?
If you just want to ensure that the payment date is 40 days after invoice recipt, then set you just have to enter the number of days in the payment terms and the baseline date stays as the invoice date (etc.)
Steve B -
Baseline Date for Due Date Calculation required for S/L indicators
Hello,
Iu2019m facing the following problem
Iu2019m trying to insert an invoice (using a customer master record) but the system blocks me because the field ZFBDT (Baseline Date for Due Date Calculation) is a Required entry.
The strange thing is that if I use a S/L indicators the field is mandatory, if not the date may be defaulted.
I checked in OB41 but there are non differences between Special PK and normal PK.
Any ideas?
Thanks in advance
AlbertoDear Alberto,
the field "Due On (BSEG-ZFBDT)" cannot be controlled with field status.
It is controlled by field attribute of screen painter (Tcd: SE51). If
you look at element attribute for "Due On" field, a flag for required
entry is activated. In this case, field status has no control over
the field.
As of release 3.1G, field BSEG-ZFBDT is hardcoded in most FI screens
to be mandatory and cannot be influenced by any field status
changes. This situation is only valid when posting with special G/L
indicator (ie PK 29/39).
SAP development team has determined that this is a critical field. The
reason behind this is that this special GL screen and the data entered
here are very important to many other programs. This data affects
liabilities and receivables where due date is necessary almost
everytime. Thus, we changed this field in this screen in order to
prevent problems in many other areas. The reason is explained further
in note 95079.
I hope this helps You.
mauri -
Baseline Duration custom field not calculating duration properly
Hi,
I am using MS Project server 2010. In it, I created one custom field named 'Baseline_Duration' similar to 'Baseline Duration' & applied the formula 'ProjDateDiff([Baseline Start], [Baseline Finish], "Standard")'. In Baseline_Duration
& Baseline Duration columns, values should be same. But for some tasks, values in Baseline_Duration column is different from Baseline Duration column, & for other tasks, both are same.
Please suggest me why values in both columns are different for some tasks?
Thanks & Regards Pradeep GangwarPradeep,
It sounds like the issue might be within the setting for that 'Baseline_Duration' field and calculations
for summary rows.
In cases where Baseline Duration was saved for individual tasks without rolling up to summaries rows - you may have deviations. Applying "Use Formula"
for summary rows should do the trick.
Regards,
Alex -
FI posting baseline calculation is wrong.
HI expart.
in userexit_fill_xkomk1how to imlplennt for sap note -112385 for baseline calculation is wrong.
What i will do for baseline calulation is coming as creation date.
Thanks
Dhirendra.Hi,
By any chance, did the user enter march date in FB08 screen ?
Best Regards,
Madhu -
CCMS threshold Value baseline calculation
Hi Guys,
I am looking CCMS threshold value baseline calculation for ECC, BW, XI, SRM, CRM, APO & Solman systems. Many portals are provided the description of each MTE class , but not provided baseline calculation.
Please let us know some expertise advice
Thanks.
ManjunathDear. Marc P. Gilomen.
I totally understand what you are written above.
The threshold value shouldn't be changed until I change the rule related to the product.
However, after I changed the rule, I have expected the threshold value should be changed according to the rule.
But, it's not.
This is the point.
After I change the rule, for example 35% to 45%, the threshold value of GTS preference determination transaction '/SAPSLL/PRECA01' is changed. But, The replicated sales order's threshold value is not changed. And delivery, billing is the same with salesorder also.
It's not changed whatever I do.
So, I want to solve this problem. But until now, I didn't find the answer.
Thank you for reading.
Best regards,
Jong Hwan -
Bapi_acc_document post is not calculating baseline date based pymnt terms
Hello friends,
Im using bapi_acc_document_post to post db and cr note and i m passing payment terms in the input file but the bapi is not calculating baseline date .
pleasee let me knw the solution.
Regards,
Sunnythat's the disadvantage of bapis and direct input in opposite to BDC. So use "old" rfbibl00 with batch input!
A.
Maybe you are looking for
-
I'm new to JSF and Creator. I was trying to put AJAX functionality with Ajax4JSF to a simple JSF page I made with Java Studio Creator 2 (update 1). I did as they instructed in their tutorials. But it didn't work. Can anyone please tell if there is an
-
Cannot reset Airport Base Station (Graphite...)
Pls can anyone advise on next step... I need to reconfigure my OLD graphite base station as I bought this from someone who +_has forgotten his password_+. I have followed step by step of the Apple Support instruction... http://support.apple.com/kb/HT
-
Our hard drive recently crashed. Luckily, the files were backed up. When my daughter recently opened Photo Booth, it told her it could not locate the library. If I choose "Choose Existing," it takes me to a few different photo libraries, including o
-
Why flv videos don't show in version 5.3?
I have bought Keynote 09 5,3 few days ago when I want to show an old presentation (Keynote old version) with flv videos, don't show the images. Only works audio!!! ??
-
Is there a pre insert trigger type function
I have a bc4j application with master-detail view form. before or on committing a new record by clicking the junavigation bar button in the detail, is it possible to call a function to set a date value equal to system date? or is there another way to